我需要设置MFMailComposeViewController的消息体的视图大小。 我怎样才能得到这个观点?
以下是创建电子邮件发件人的代码。
MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:titleForEmail];
[controller setMessageBody:textForEmail isHTML:isHtml];
[parentController presentModalViewController:controller animated:YES];
[controller release];
答案 0 :(得分:6)
您可能会因此被拒绝,但它不使用任何API,而是循环浏览子视图。我正在尝试。
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
for (UIView *subview in [controller.view subviews]) {
for (UIView *myview in [subview subviews]) {
for (UIView *theview in [myview subviews]) {
if ([NSStringFromClass([theview class]) isEqualToString:@"MFMailComposeView"]) {
for (UIView *aview in [theview subviews]) {
for (UIView *thisview in [aview subviews]) {
if ([NSStringFromClass([thisview class]) isEqualToString:@"MFComposeScrollView"]) {
for (UIView *bview in [thisview subviews]) {
if ([NSStringFromClass([bview class]) isEqualToString:@"MFComposeTextContentView"]) {
NSLog(@"%@", ((UITextView *)bview).text);
}
}
}
}
}
}
}
}
}
}
这在iOS6中被破坏了。试图找到一种解决方法。
答案 1 :(得分:4)