iphone - UITabBarController not changing the title color after setSelectedIndex -
actually, problem in question title. thing need change active tab of uitabbarcontroller in application. following:
[self.tabbarcontroller setselectedindex:2]; //2 instance the strange thing changes selected tab still title color of tab stays same (gray) , want become white if tapped on tab. have suggestions?
edit:
here code sets initial state of tabbar:
uitabbarcontroller *mvc = [[uitabbarcontroller alloc]init]; accountmanagmentviewcontroller *accountvc = [[accountmanagmentviewcontroller alloc]init]; listtableviewcontroller *ltvc = [[listtableviewcontroller alloc]init]; uinavigationcontroller *listnavcon = [[uinavigationcontroller alloc]initwithrootviewcontroller:ltvc]; calendarviewcontroller *calendarvc = [[calendarviewcontroller alloc]init]; uinavigationcontroller *calendarnavcon = [[uinavigationcontroller alloc]initwithrootviewcontroller:calendarvc]; listsmanagerviewcontroller *listsmanager = [[listsmanagerviewcontroller alloc]init]; uinavigationcontroller *listsnavcon = [[uinavigationcontroller alloc]initwithrootviewcontroller:listsmanager]; settingsviewcontroller *settings = [[settingsviewcontroller alloc]init]; uinavigationcontroller *settingsnav = [[uinavigationcontroller alloc]initwithrootviewcontroller:settings]; [accountvc.tabbaritem setfinishedselectedimage:[[easyuitheme currenttheme]tabbarusericonimageactive:yes] withfinishedunselectedimage:[[easyuitheme currenttheme]tabbarusericonimageactive:no]]; [listsnavcon.tabbaritem setfinishedselectedimage:[[easyuitheme currenttheme]tabbarlistsiconimageactive:yes] withfinishedunselectedimage:[[easyuitheme currenttheme]tabbarlistsiconimageactive:no]]; [calendarnavcon.tabbaritem setfinishedselectedimage:[[easyuitheme currenttheme]tabbarcalendariconimageactive:yes] withfinishedunselectedimage:[[easyuitheme currenttheme]tabbarcalendariconimageactive:no]]; [listnavcon.tabbaritem setfinishedselectedimage:[[easyuitheme currenttheme]tabbarmain10iconimageactive:yes] withfinishedunselectedimage:[[easyuitheme currenttheme]tabbarmain10iconimageactive:no]]; [settings.tabbaritem setfinishedselectedimage:[[easyuitheme currenttheme]tabbarsettingsiconimageactive:yes] withfinishedunselectedimage:[[easyuitheme currenttheme]tabbarsettingsiconimageactive:no]]; [accountvc.tabbaritem settitle:nslocalizedstring(@"account", nil)]; [listsnavcon.tabbaritem settitle:nslocalizedstring(@"lists", nil)]; [calendarnavcon.tabbaritem settitle:nslocalizedstring(@"calendar", nil)]; [listnavcon.tabbaritem settitle:nslocalizedstring(@"words", nil)]; [settings.tabbaritem settitle:nslocalizedstring(@"settings", nil)];
accountmanagmentviewcontroller *accountvc = [accountmanagmentviewcontroller instanceofnibnamed:@"accountmanagmentviewcontroller"]; uinavigationcontroller *accountvcnavigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:accountvc]; accountvcnavigationcontroller.navigationbarhidden = yes; uitabbaritem* accounttabbaritem = [[uitabbaritem alloc] init]; [accounttabbaritem settitle:@"account"]; [accounttabbaritem setfinishedselectedimage: [uiimage imagenamed:@"tab3"] withfinishedunselectedimage: [uiimage imagenamed: @"tab3"]]; [accountvcnavigationcontroller settabbaritem: accounttabbaritem]; [viewcontrollers addobject:accountvcnavigationcontroller]; try this. may work you.
Comments
Post a Comment