【问题标题】:MFMailComposer not working in io6 landscape modeMFMailComposer 在 io6 横向模式下不工作
【发布时间】:2012-11-22 10:34:09
【问题描述】:
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 测试中无法运行

【问题讨论】:

  • 试试这个。 mailComposeController.wantsFullScreenLayout = YES;
  • img1 是干什么用的? (只是想理解它:D)
  • 其实 img1 什么都不是,无用的 obj,如果有人知道,请帮忙,我卡在这里
  • 在 ios6 中显示 mailComposer 的 viewController 是否旋转为横向?
  • 我的应用程序只在横向,所以它不能在 ios6 中运行,但在 ios5 中运行良好

标签: iphone objective-c ios ios6


【解决方案1】:

在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 实例

【讨论】:

  • 我不认为它会解决问题,该应用程序适用于每个 viewControllers,只有 MFMailComposeViewController 不能很好地显示。
  • 我在旋转时也有类似的问题,使用上述更改解决的问题请实施并告诉我
猜你喜欢
  • 2023-04-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-11
  • 2013-06-21
  • 2016-01-09
  • 1970-01-01
相关资源
最近更新 更多