ios - 在 UITabBarController 上选择选项卡时如何呈现 ViewController?

标签 ios

我有一个带有配置文件选项卡的 UITabBarController。如果按下配置文件选项卡,但用户未登录,我想显示一个登录 View Controller 。如果用户按下取消,我希望选项卡栏 Controller 选择与以前相同的选项卡。

最佳答案

你需要使用 UITabBarControllerDelegate

-tabBarController:shouldSelectViewController:

-tabBarController:didSelectViewController:

检测您的配置文件 Controller 并显示登录 Controller 。

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITabBarControllerDelegate_Protocol/index.html#//apple_ref/occ/intf/UITabBarControllerDelegate

关于ios - 在 UITabBarController 上选择选项卡时如何呈现 ViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28613117/

相关文章:

ios - 如何在 Swift 4 中解析 A​​lamofire 中的数据

ios - 具有透明背景的 UIModalPresentationFormSheet?

ios - 如何知道安装我的ios应用程序的用户数

ios - UITableViewCell 中的渐变出现在内容上

ios - 以编程方式创建和显示 UIPickerView

ios - <FIRInstanceID/WARNING> 无法生成 key 对

ios - 如何删除我用循环创建的多个按钮?

ios - GenerationAssetSymbols 中的 Xcode 15 beta 错误

ios - 如果日期是一个月的开始,则获取当前周的所有日期返回不正确

ios - 当表格滚动时,重新加载行会使表格变为 "jump"