开发者

How to check which Tab Bar item is active?

开发者 https://www.devze.com 2023-02-26 19:48 出处:网络
I am tr开发者_JAVA百科ying to figure out how to check which tab bar button is active? Currently I have 5 to 6 different tab bar buttons, and want to check which one is active. Any input will be apprec

I am tr开发者_JAVA百科ying to figure out how to check which tab bar button is active? Currently I have 5 to 6 different tab bar buttons, and want to check which one is active. Any input will be appreciated here.

Thanks,

Shawn


do you have UITabbar or UITabbarController?

if UITabbar then set tag for each item and then you see which item is selected using -

tabBarController.tabBar.selectedItem.tag

if UITabbarController then use

tabBarController.selectedIndex


UITabBarController has a selectedViewController and a selectedIndex property. Here is the UITabBarController documentation

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号