2012-11-22 62 views
2
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的米测试不工作的设备MFMailComposer不IO6横向模式

+0

一次尝试之后。 mailComposeController.wantsFullScreenLayout = YES; – Murali

+0

img1是什么? (只是试图理解它:D) –

+1

其实img1是没有,无用的obj,plz帮助,如果有人知道,米卡在这里 –

回答

0

尝试以下代码中的appdelegate didfinishloading

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实例工作

+0

我不认为它会纠正这个问题,该应用程序适用于每个viewControllers,只有MFMailComposeViewController不能很好地显示。 – Saliom

+0

我也有类似的问题在旋转,问题解决使用上述变化 请执行并让我知道 – Vishnu

0

我修正了这个问题:

我做进口:

#import <MessageUI/MFMailComposeViewController.h> 

但我忘了这一点:

#import <MessageUI/MessageUI.h> 

加入MessageUI.h,没有更多的问题的进口在iOS 6