如何获取MFMailComposeViewController的消息体的视图?

Sta*_*Pak 1 email ios

我需要设置MFMailComposeViewController的消息体的视图大小.我怎样才能获得视图?

以下是创建电子邮件发件人的代码.

MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:titleForEmail];
[controller setMessageBody:textForEmail isHTML:isHtml];     
[parentController presentModalViewController:controller animated:YES];
[controller release];
Run Code Online (Sandbox Code Playgroud)

Bob*_*ryn 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);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

UPDATE

这在iOS6中被打破了.试图找到一种解决方法.