iphone - UITabbar 还使用额外的 UIButton [hell] swift 4 更改选项卡

标签 iphone swift xcode

Swift 4 编程新手需要 UIButton 方面的帮助。

约会按钮有两个,一个在tabbar上,另一个是UIButton。 我如何编程 UIButton 以导航到“UITabbar 上的约会 UIView”而不在导航时消失标签栏?

最佳答案

我不知道我是否理解你的意思,但如果我是对的,你想通过触摸 UIButton 访问特定选项卡,而不是 UITabBarController。

解决方案是向您的按钮添加一个操作,如下所示:

@IBAction func goToAppointments(sender: AnyObject) {
    tabBarController?.selectedIndex = x
}

其中x是一个整数,表示“约会标签”在标签栏中的位置。

关于iphone - UITabbar 还使用额外的 UIButton [hell] swift 4 更改选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50598326/

相关文章:

iphone - 文件系统中的 iOS 框架二进制文件在哪里?

iphone - 使用 css 多列在 UIWebView 中对 html 进行分页时出错

ios - 如何从 Appdelegate 打开 Viewcontroller?

ios - 拉动刷新添加相同的数据已经有

swift - 关于线程 1 : Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

ios - 如何在 Store Kit 应用内购买中测试取消订阅?

iphone - 如何在 UITableView 中的每个部分打一个复选标记?

html - 通过 UIWebView 从网页中在 Safari 中打开链接

C++ on Xcode 7.01 on El Capitan Error -> Undefined symbols for architecture x86_64 :

objective-c - MWPhotoBrowser 的 IOS 8 中缺少方法声明的上下文