简体   繁体   中英

How can I determine UITabBarItem position?

如何确定UITabBarItem是否具有标题“ Hello”且位置为0?

我宁愿让使用项目的索引indexOfObjecttabBar项目数组:

NSUInteger index = [tabBar.items indexOfObject:item];

Use the items property of the UITabBar, like:

if([[myTabBar items] indexOfObject:myTabBarItem] == 0)
{
  UITabBarItem* theItem = [[myTabBar items] objectAtIndex:0];

  if([theItem.title isEqualToString:@"Hello"])
  {
    // it's in position 0 and has title "Hello"
  }
}

uitabbaritem继承自uibaritem,后者定义了标签和标题属性。

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