我有UITabBarController
並推動兩個視圖。我希望第一個視圖成爲默認值,並且按鈕在加載時處於「選定」狀態。的UITabBarController所選項目
我的問題是tabBarItem沒有選擇的背景時,它加載。我必須點擊它才能顯示選中的內容。我也爲標籤欄項目使用自定義圖像,並在每個視圖中配置它們,並將其添加到tabBarController中。
我使用這個設置選擇的項目:
_tabBarController.selectedViewController = [_tabBarController.viewControllers objectAtIndex:0];
的UITabBarItem獲取我添加到tabBarController每個視圖中創建:
-(UITabBarItem *)tabBarItem
{
return [[UITabBarItem alloc] initWithTitle:@"" image:[UIImage imageNamed:@"tab_select_indicator_map.png"] tag:0];
}
我怎麼也有tabBarItem顯示選擇的狀態?
你有沒有找到一個解決問題了嗎?我推送一個tabbarcontroller並且最初的選項卡圖標未被選中(儘管視圖控制器正確顯示)。只在實際的選項卡圖標上點擊才能選中它。我以編程方式設置'selectedIndex'。 –