本文介绍了MFMailComposer在io6横向模式下不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

if ([MFMailComposeViewController canSendMail]) {
    MFMailComposeViewController * mailComposeController=[[MFMailComposeViewController alloc]init];
    mailComposeController.mailComposeDelegate = self;
  //  mailComposeController.wantsFullScreenLayout = NO;
    [mailComposeController setSubject:@"WallPaperApp."];
    [mailComposeController setMessageBody:@"This is my new Wallpaper." isHTML:NO];
    UIImage *img=mainImageView.image;
    UIImage *img1=[UIImage imageNamed:@"aaa.jpg"];
    NSData *imageData = UIImagePNGRepresentation(img);
    [mailComposeController addAttachmentData:imageData mimeType:@"image/jpg" fileName:[NSString stringWithFormat:@"photo.png"]];

    [self presentModalViewController:mailComposeController animated:YES];
    //[mailComposeController release];

}

它在ios5中可以正常工作,但不能在设备上的ios6 m测试中工作

its working fine in ios5 but not working in ios6 m testing on device

推荐答案

在appdelegate的didfinishloading中尝试下面的代码

Try below code in didfinishloading in appdelegate

rootController =
    [[firstViewController alloc]
     initWithNibName:@"firstViewController" bundle:nil];
    navigationController = [[UINavigationController alloc]initWithRootViewController:rootController];
        window = [[UIWindow alloc]
                  initWithFrame:[[UIScreen mainScreen] bounds]];
        [window addSubview:navigationController.view];
[window makeKeyAndVisible];

rootController是uiviewcontroller实例

rootController is a uiviewcontroller instance

这篇关于MFMailComposer在io6横向模式下不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 13:26