簡體   English   中英

如何確定UITabBarItem的位置?

[英]How can I determine UITabBarItem position?

如何確定UITabBarItem是否具有標題“ Hello”且位置為0?

我寧願讓使用項目的索引indexOfObjecttabBar項目數組:

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

使用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