繁体   English   中英

iPhone,UINavigationController和UITabBar如何呈现模式对话框,无论选择哪个选项卡?

[英]iPhone, UINavigationController and UITabBar how to present a modal dialog regardless of the selected tab?

我在应用程序中有一个UINavigationController和一个UITabBar。 标签栏中的每个ViewController都有自己的UINavigationController。

无论当前选择的选项卡如何,我都希望能够向用户呈现模式对话框(警报/提醒/合法/加入邮件列表)。

现在我有一个我的UIViewControllers处理呈现对话框的行为,但除非选中了选项卡,否则用户将看不到它。

我该如何解决这个问题? 故事板浮现在脑海中,但我的项目太深,无法在当前状态下重写故事板。

谢谢!

你可以在UITabBarController上呈现它。

[tabBarController presentModalViewController:animated:];

...或者您可以轻松地将UIAlertView /创建类别 子类化为显示自定义模态视图,只需调用即可

UIAlertView *alert = 
  [[UIAlertView alloc] initWithTitle:@"" 
                             message:@"" 
                            delegate:nil 
                   cancelButtonTitle:@"" 
                   otherButtonTitles:nil];

[alert showCustom]; // <---- FROM CATEGORY

[alert release];

这是一个例子: http//goo.gl/7jaE8

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM