ios - loading Tabbar controller from view controller -
i working project in have have login page , after successful login should have tabbar view (i using tab bar controller) when try load tab bar controller using following code.nothing works out.
loginsuccess *viewcontroller = [[loginsuccess alloc] initwithnibname:@"loginsuccess" bundle:nil]; [self.view addsubview:viewcontroller.tabbarcontroller.view]; [viewcontroller release];
please me.
i same work me call appdelegate after success of login response [mappdelegate loadtabbar];
//call function in delegate file load tabbar view whom code follow
#pragma mark - #pragma mark load tabbar -(void)loadtabbar { self.tabbarcontroller = [[uitabbarcontroller alloc] init]; tabbarcontroller.delegate = self; myalarmvc *myalarmvc = [[myalarmvc alloc] initwithnibname:@"myalarmvc" bundle:nil]; uinavigationcontroller *myalarmnvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:myalarmvc]; myalarmnvc.navigationbar.tintcolor = [uicolor whitecolor]; [myalarmvc release]; myvideosvc *myvideovc = [[myvideosvc alloc] initwithnibname:@"myvideosvc" bundle:nil]; uinavigationcontroller *myvideonvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:myvideovc]; myvideonvc.navigationbar.tintcolor = [uicolor whitecolor]; [myvideovc release]; myfriendsvc *myfriendvc = [[myfriendsvc alloc] initwithnibname:@"myfriendsvc" bundle:nil]; uinavigationcontroller *myfriendnvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:myfriendvc]; myfriendnvc.navigationbar.tintcolor = [uicolor whitecolor]; [myfriendvc release]; mymessagevc *mymessagevc = [[mymessagevc alloc] initwithnibname:@"mymessagevc" bundle:nil]; uinavigationcontroller *mymessagenvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:mymessagevc]; mymessagenvc.navigationbar.tintcolor = [uicolor whitecolor]; [mymessagevc release]; myprofilevc *myprofilevc = [[myprofilevc alloc] initwithnibname:@"myprofilevc" bundle:nil]; uinavigationcontroller *myprofilenvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:myprofilevc]; myprofilenvc.navigationbar.tintcolor = [uicolor whitecolor]; [myprofilevc release]; tabbarcontroller.viewcontrollers = [nsarray arraywithobjects:myalarmnvc,myvideonvc, myfriendnvc,mymessagenvc,myprofilenvc, nil]; [myalarmnvc release]; [myvideonvc release]; [myprofilenvc release]; [myfriendnvc release]; [mymessagenvc release]; [self.window addsubview:tabbarcontroller.view ]; //tabbarcontroller.navigationcontroller.navigationbarhidden = yes; [self.tabbarcontroller release]; } - (void)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller1 didselectviewcontroller:(uiviewcontroller *)viewcontroller{ nsarray *vc= tabbarcontroller1.viewcontrollers; (int = 0; < [vc count]; i++) { uinavigationcontroller *nc = [vc objectatindex:i]; if (nc == tabbarcontroller1.selectedviewcontroller) { continue; } [nc poptorootviewcontrolleranimated:no]; } }
if got problem tell me view names of tabbar
Comments
Post a Comment