iphone - Insert Tab bar at second view of application and tab bar contains more than 5 tabs -
other solution adding 6 tabs acceptable
as more 5 tabs have used ciexpandabletabbarcontroller problem is: if add ciexpandabletabbarcontroller this: self.window.rootviewcontroller=ciexpandabletabbarcontroller; there no problem..
but need add second view , views after that.. first view login after first, view tab bar should visible
now getting output this:
selected tebbar item image not displayed
but want output this:
i have added tab bar this:
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [self maketabbar]; [[uiapplication sharedapplication] setstatusbarhidden:yes withanimation:uistatusbaranimationslide]; //============== self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { if([uiscreen mainscreen].bounds.size.height == 568) { self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller_iphone" bundle:nil]; } else { self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller_3" bundle:nil]; } } else { self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller_ipad" bundle:nil]; } uinavigationcontroller *nvc=[[uinavigationcontroller alloc] initwithrootviewcontroller:self.viewcontroller]; self.window.rootviewcontroller=nvc; [nvc setnavigationbarhidden:yes]; // self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; return yes; } -(void)maketabbar { // self.tabbarcontroller=[[uitabbarcontroller alloc] init]; // self.tabbarcontroller.customizableviewcontrollers = nil; productsearchviewcontroller *homeobj; if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { if([uiscreen mainscreen].bounds.size.height == 568) { homeobj=[[productsearchviewcontroller alloc] initwithnibname:@"productsearchviewcontroller" bundle:nil]; } else { homeobj=[[productsearchviewcontroller alloc] initwithnibname:@"productsearchviewcontroller_3" bundle:nil]; } } else { homeobj=[[productsearchviewcontroller alloc] initwithnibname:@"productsearchviewcontroller~ipad" bundle:nil]; } uinavigationcontroller *tab1controller = [[uinavigationcontroller alloc] initwithrootviewcontroller:homeobj]; tab1controller.title=@"product seach"; tab1controller.tabbaritem.image=[uiimage imagenamed:@"productsearch.png"]; wheretobuyviewcontroller *chatlistobj; if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { if([uiscreen mainscreen].bounds.size.height == 568) { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller" bundle:nil]; } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller_3" bundle:nil]; } } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller~ipad" bundle:nil]; } uinavigationcontroller *tab2controller = [[uinavigationcontroller alloc] initwithrootviewcontroller:chatlistobj]; tab2controller.title=@"where buy"; tab2controller.tabbaritem.image=[uiimage imagenamed:@"wheretobuy.png"]; //===========tab3 if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { if([uiscreen mainscreen].bounds.size.height == 568) { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller" bundle:nil]; } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller_3" bundle:nil]; } } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller~ipad" bundle:nil]; } uinavigationcontroller *tab3controller = [[uinavigationcontroller alloc] initwithrootviewcontroller:chatlistobj]; tab3controller.title=@"where buy"; tab3controller.tabbaritem.image=[uiimage imagenamed:@"wheretobuy.png"]; //====================tab4 if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { if([uiscreen mainscreen].bounds.size.height == 568) { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller" bundle:nil]; } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller_3" bundle:nil]; } } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller~ipad" bundle:nil]; } uinavigationcontroller *tab4controller = [[uinavigationcontroller alloc] initwithrootviewcontroller:chatlistobj]; tab4controller.title=@"where buy"; tab4controller.tabbaritem.image=[uiimage imagenamed:@"wheretobuy.png"]; //==============tabtab5 if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { if([uiscreen mainscreen].bounds.size.height == 568) { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller" bundle:nil]; } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller_3" bundle:nil]; } } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller~ipad" bundle:nil]; } uinavigationcontroller *tab5controller = [[uinavigationcontroller alloc] initwithrootviewcontroller:chatlistobj]; tab5controller.title=@"where buy"; tab5controller.tabbaritem.image=[uiimage imagenamed:@"wheretobuy.png"]; //=========================tab 6 if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { if([uiscreen mainscreen].bounds.size.height == 568) { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller" bundle:nil]; } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller_3" bundle:nil]; } } else { chatlistobj=[[wheretobuyviewcontroller alloc] initwithnibname:@"wheretobuyviewcontroller~ipad" bundle:nil]; } uinavigationcontroller *tab6controller = [[uinavigationcontroller alloc] initwithrootviewcontroller:chatlistobj]; tab6controller.title=@"where buy"; tab2controller.tabbaritem.image=[uiimage imagenamed:@"wheretobuy.png"]; //======================= ciexpandabletabbarcontroller *tabbar=[[ciexpandabletabbarcontroller alloc] initwithviewcontrollers:[nsarray arraywithobjects:tab1controller,tab2controller,tab3controller,tab4controller,tab5controller,tab6controller, nil] andselectedindex:0]; [self.window addsubview:tabbar.view]; }
for selected image , unselected image of uitabbaritem
, there 2 properties of namely finishedselectedimage
, finishedunselectedimage
. cannot set properties because don't have setter method defined them, getter.
instead can this. suppose 'tab_1_unselimg' unselected tab image , 'tab_1_selimg' selected tab first tab of tab bar controller.
[[[[self.tabbarcontroller viewcontrollers] objectatindex:0] tabbaritem] setfinishedselectedimage:tab_1_selimg withfinishedunselectedimage:tab_1_unselimg];
Comments
Post a Comment