ios - 如何将注销按钮添加到我的 UITabBar

标签 ios swift uitabbar

我有一个 UITabBar Controller ,我的其他 ViewController 嵌套在其中。我想添加一个注销按钮,它只会触发警报,不会进入另一个 View Controller 。我该怎么做?

最佳答案

您可以使用 UITabBarControllerDelegate 在用户尝试显示选项卡时收到通知。在这个委托(delegate)方法中,你可以返回 false 并拦截来做你想做的事。

方法如下:

func tabBarController(tabBarController: UITabBarController, shouldSelectViewController viewController: UIViewController) -> Bool {

}

关于ios - 如何将注销按钮添加到我的 UITabBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41618116/

相关文章:

ios - 如何在没有 UITabBarController 的情况下使用 UITabBar?

ios - swift + 核心数据 : Can not set a Bool on NSManagedObject subclass - Bug?

ios - 加速第一个 UIImageView 动画(强制缓存图像)

html - 如何在 swift 2.0 中解码 HTML 实体?

ios - 如果单击 UISearchBar,则更改 UITableView 位置 : [using ModernSearchBar]

swift - 具有外部检测的变异函数要变异的变量

ios - 没有 moreViewController 的 UITabBarController 的最大选项卡数

ios - iOS填充我的TabBar图标图像?

ios - 一个iOS开发人员可以居住在哪个国家/地区以便从Apple接收付款?

iphone - 原力风景 iOS 6