MFMailComposer not working in io6 landscape mode

2019-07-09 11:56发布

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];

}

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

2条回答
ゆ 、 Hurt°
2楼-- · 2019-07-09 12:30

I fixed the exact same problem this way:

I did import:

#import <MessageUI/MFMailComposeViewController.h>

But I forgot this:

#import <MessageUI/MessageUI.h>

After adding the import of MessageUI.h, no more problems on iOS 6.

查看更多
beautiful°
3楼-- · 2019-07-09 12:31

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 is a uiviewcontroller instance

查看更多
登录 后发表回答