2012-04-17 55 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指数值写这个代码。