0

In my application After login successful my schedule screen opens. It has below 3 TabbarItems with My Schedule option itself. When i come to this screen My schedule items image should be highlighted and other 2 r as normal. How I can achieved this? Plz help me soon.

python
  • 1,407
  • 1
  • 15
  • 31

2 Answers2

0

You can do it using the selectedIndex property of UITabBarController

    tabBarController.selectedIndex = 0;
Vidya Murthy
  • 530
  • 1
  • 8
  • 22
  • Can you please tell me how i can do this. I am new in iPhone. -python – python Apr 17 '12 at 12:28
  • Post some code as to how you are initializing the tab bar controller. – Vidya Murthy Apr 17 '12 at 12:42
  • I drag and drop UITabbar and UITabBarItems in viewbased application. When login get successful Myschedule screen comes. Below it has 3 tabbaritems one of these is myschedule. I want that highlighted when this screen comes. Now all 3 r unhighlighted. Is there any option to make one highlighted n other 2 unhighlited? – python Apr 18 '12 at 05:00
0

@python

You use this code I think this will help for you and it also highlighted your tab bat item which you are selected.

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


onecontroller  *second = [[onecontroller alloc] initWithNibName:nil bundle:nil];
second.title=@"Leaderboard";

secondcontroller *third=[[secondcontroller alloc]initWithNibName:nil bundle:nil];
third.title=@"Scorecards";

thirdcontroller *one=[[thirdcontroller alloc]initWithNibName:nil bundle:nil];
 one.title=@"Compete";

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

and add this line in your viewdidload which view you first highleted

tabBarController.selectedIndex = 0;

or also add on above also but then its alwayes highlited if u want changeable then every viewcontroller view did load you write this code with chage index value.

vishiphone
  • 750
  • 7
  • 14