拆分视图控制器中的弹出视图控制器类似于iMessage?

时间:2013-10-25 08:27:51

标签: ios iphone objective-c ipad ios7

我有申请Split View controller. 我想有一个弹出式视图控制器,当有一些特殊情况时(例如用户未注册)显示。 您可以在iPad中的Apple Messages应用程序中看到此信息。 有没有办法在没有第三方控制器的情况下做到这一点?

编辑:我找到了解决方案:在storyboard用户可以在atributes inspector的模拟mectrics部分设置Form Sheet。之后使用模态转换可以打开弹出视图。

1 个答案:

答案 0 :(得分:2)

If you are using Storyboard.... if using nib replace storyboard with your nib file

 // Create and configure a new detail view controller appropriate for the selection.
            UIViewController *objViewController = [UINavigationController new];

            objViewController = [self.storyboard                                   instantiateViewControllerWithIdentifier:@"WelcomePopupNavigationController"];                

            objViewController.modalPresentationStyle = UIModalPresentationFormSheet;
            objViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

            [self presentViewController:objViewController animated:YES completion:nil];

            //it's good to do this after presentModalViewController, but not neccessary if you using form sheet size of your view controller
            objViewController.view.superview.frame = CGRectMake(0, 0, 540, 620);
            objViewController.view.superview.center = self.view.center;

// vKj