简体   繁体   English

如何确定UITabBarItem的位置?

[英]How can I determine UITabBarItem position?

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

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

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

Use the items property of the UITabBar, like: 使用UITabBar的items属性,例如:

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,后者定义了标签和标题属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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