2012-04-17 56 views
0

在我的應用程序登錄成功後,我的日程安排屏幕打開。它具有低於3個TabbarItems和My Schedule選項本身。當我來到這個屏幕時,我的日程安排項目圖像應該突出顯示,其他2個r正常。我怎麼能做到這一點? Plz很快幫到我。有什麼辦法顯示TabBarItem圖像默認爲選中?

回答

0

可以使用的UITabBarController

tabBarController.selectedIndex = 0; 
+0

你能告訴我怎麼做到這一點。我是iPhone新手。 -python – python 2012-04-17 12:28:20

+0

發佈一些關於如何初始化標籤欄控制器的代碼。 – 2012-04-17 12:42:40

+0

我拖放UITabbar和UITabBarItems在基於視圖的應用程序中。當登錄成功時Myschedule屏幕出現。它下面有3個tabbaritems其中之一是myschedule。我希望在屏幕出現時突出顯示。現在所有3個不明顯的。有沒有其他選項可以讓其他2個選項突出顯示? – python 2012-04-18 05:00:37

0

selectedIndex財產做@python

您可以使用此代碼,我認爲這將有助於你和它也強調你所選擇的選項卡的蝙蝠項目。

UITabBarController *tabbar1 = [[UITabBarController alloc] init]; 


onecontroller *second = [[onecontroller alloc] initWithNibName:nil bundle:nil]; 
[email protected]"Leaderboard"; 

secondcontroller *third=[[secondcontroller alloc]initWithNibName:nil bundle:nil]; 
[email protected]"Scorecards"; 

thirdcontroller *one=[[thirdcontroller alloc]initWithNibName:nil bundle:nil]; 
[email protected]"Compete"; 

tabbar1.viewControllers = [NSArray arrayWithObjects:one, second,third,nil]; 
tabbar1.view.frame=CGRectMake(0, 0, 320, 460); 
[self.view addSubview:tabbar1.view]; 

,並在您的viewDidLoad其中查看您第一highleted

tabBarController.selectedIndex = 0添加此行;

或者也可以在上面加上,但是如果你想改變它的高調,那麼每個viewcontroller視圖都會加載你用chage指數值寫這個代碼。