【发布时间】:2016-03-19 19:39:12
【问题描述】:
我有主仪表板 (UITableViewController),一旦我登录后,我需要在此页面上显示一条欢迎消息,该消息使用 UIViewController 显示。
如何通过我的ViewDidAppear() 方法显示此弹出窗口?
我正在使用以下代码,但它不起作用
-(void)viewDidAppear:(BOOL)animated{
popupObj= [self.storyboard instantiateViewControllerWithIdentifier:@"popup"];
[popupObj setModalPresentationStyle:UIModalPresentationCurrentContext];
}
请帮帮我..
我看到了几个stackoverflow 链接
更新
当我将我的代码更改为这个时
-(void)viewDidAppear:(BOOL)animated{
popupObj= [self.storyboard instantiateViewControllerWithIdentifier:@"popup"];
// [popupObj setModalPresentationStyle:UIModalPresentationCurrentContext];
popupObj.modalPresentationStyle = UIModalPresentationOverCurrentContext;
popupObj.modalTransitionStyle = UIModalPresentationPopover;
[self presentViewController:popupObj animated:YES completion:nil];
}
现在我可以看到我的UIViewController 弹出但现在UIViewController
以全屏视图显示。
但我只需要这个frame (320 , 320)
【问题讨论】:
-
您的链接问题的答案提供了大量代码,您是尝试全部实现还是仅尝试这两行?
-
是的尝试了与此相关的所有内容
-
您可以编辑您的问题以包含所有相关代码吗?并且还包括你期望它做什么与它实际做了什么的描述。
-
你的代码在哪里展示viewcontroller?
-
现在更新问题
标签: ios objective-c uiviewcontroller popup