我是iOS開發新手,我已經直接從IOS 5開始。我創建了一個由tabview控制器作爲其rootview控制器的故事板。我已經把2個標籤。取消選擇或取消選擇iOS 5中tabbar中的所有選項卡
我想先取消/取消選擇所有選項卡。我該怎麼做呢?我已經嘗試了以下內容
UIView *view = [[UIView alloc]initWithNibName:@"view" bundle:[NSBundle mainBundle]];
[self.tabBarController setSelectedViewController:nil];
[self.tabBarController setSelectedViewController:view];
其中我添加了一個標識符爲「view」的視圖。
但這並沒有工作,它給了錯誤:
unrecognized selector sent to instance
我也試過以下
[self.tabBarController.tabBar setSelectedItem:nil];
但它說
'NSInternalInconsistencyException', reason: 'Directly modifying a tab bar managed by a tab bar controller is not allowed.'
我曾嘗試在此代碼第一個選項卡的控制器。我想這樣做是因爲我想在第一個選項卡視圖頂部放置一個默認視圖,並在下面的任何選項卡上單擊使用後將其隱藏。
任何方式設置動畫? – 2014-11-10 12:59:42