如果我在视频控制器的iPad(iOS 8)上运行此代码:
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc]init]autorelease];
controller.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:controller animated:YES completion:nil];
我获得了全屏消息撰写视图。但我认为MFMessageComposeViewController
忽略其模态表示风格的任何地方都没有文档或参考。这是预期的吗?或者我错过了什么?
答案 0 :(得分:3)
最近针对iOS8面临类似问题。看起来MFMessageComposeViewController
似乎忽略了modalPresentationStyle属性。奇怪的是,MFMailComposeViewController
似乎没有这个问题。无论如何,要解决它,我将MFMessageComposeViewController
嵌入到UIViewController中并改为呈现。以下是完成此任务的代码:
var messageViewController = MFMessageComposeViewController()
messageViewController.messageComposeDelegate = self
let containerViewController = UIViewController()
containerViewController.view.addSubview(messageViewController.view)
messageViewController.willMoveToParentViewController(nil)
containerViewController.addChildViewController(messageViewController)
messageViewController.didMoveToParentViewController(containerViewController)
containerViewController.modalPresentationStyle = .OverFullScreen
containerViewController.transitioningDelegate = self
presentViewController(containerViewController, animated: true, completion: nil)