iPhone、UINavigationController 和 UITabBar 如何呈现模式对话框,而不管所选选项卡如何?

发布于 2024-12-20 14:35:43 字数 318 浏览 3 评论 0原文

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

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

现在我有一个UIViewControllers 处理呈现对话框的行为,但用户不会看到它,除非已选择选项卡。

我将如何解决这样的问题?我想到了故事板,但我的项目太深了,无法在当前状态下将其重写为故事板。

谢谢你!

I have a UINavigationController and a UITabBar within the application. Each ViewController within the tabbar has its own UINavigationController.

I would like to be able to present a modal dialog to the user (an alert/reminder/legal/join mailing list) kind of action regardless of the currently selected tab.

Right now I have one of my UIViewControllers handle the act of presenting the dialog, but the user would not see it, unless the tab has been selected.

How would I go about solving such a problem? Storyboards come to mind, but my project is far too deep to rewrite it for storyboards in its current state.

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

反差帅 2024-12-27 14:35:43

您可以将其呈现在 UITabBarController 上。

[tabBarController presentModalViewController:animated:];

You could present it on the UITabBarController.

[tabBarController presentModalViewController:animated:];
神仙妹妹 2024-12-27 14:35:43

...或者您可以轻松子类化 UIAlertView/创建一个类别来在需要时显示自定义模式视图,只需调用

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

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

[alert release];

这里的示例:http://goo.gl/7jaE8

...or you can easily subclass UIAlertView/create a category to show a custom modal view when you want, simply calling

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

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

[alert release];

Here an example: http://goo.gl/7jaE8

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文