简体   繁体   中英

Enable TabBar Item in View Controller from Another in Swift

So I'm new to Xcode and Swift. I'm using the Xcode Beta with Swift 4.

I have two views with a tab bar, and I have the tab bar item on the second view disabled.

I'm wondering if there is anyway that on a button click in the view #1, I can enabled the tab bar item in view #2. Any help is appreciated!

图片

在子控制器中保留tabBarController的引用,并使用那里的索引启用/禁用tabbar项,例如:

self.tabBarController!.tabBar.items![0].enabled = false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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