ios - App delegate issues with multiple view controllers -
i created tab bar controller , implemented in app delegate before implemented other view controller.i don't know how use call them orderly.please tell me how make them arrange like.
@interface appdelegate () { uinavigationcontroller *navigation; } @property (strong, nonatomic) jasidepanelcontroller *viewcontroller; @property (strong, nonatomic) uitabbarcontroller *this; @end @implementation appdelegate @synthesize viewcontroller = _viewcontroller; - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after application launch. [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent]; self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; navigation = [[uinavigationcontroller alloc] initwithrootviewcontroller:[[viewcontroller alloc] init]]; self.window.rootviewcontroller = navigation; //uiwindow *window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // self.window = window; self.viewcontroller = [[jasidepanelcontroller alloc] init]; self.viewcontroller.shoulddelegateautorotatetovisiblepanel = no; self.viewcontroller.leftpanel = [[leftviewcontroller alloc] init]; uiviewcontroller *viewcontroller1=[[homeview alloc]init]; uiviewcontroller *viewcontroller2=[[speciality alloc]init]; uiviewcontroller *viewcontroller3=[[activity alloc]init]; uiviewcontroller *viewcontroller4 =[[notification alloc]init]; uiviewcontroller *viewcontroller5 =[[profile alloc]init]; viewcontroller1.view.backgroundcolor = [uicolor whitecolor]; viewcontroller2.view.backgroundcolor = [uicolor whitecolor]; viewcontroller3.view.backgroundcolor = [uicolor whitecolor]; viewcontroller4.view.backgroundcolor = [uicolor whitecolor]; viewcontroller5.view.backgroundcolor = [uicolor whitecolor]; uinavigationcontroller *navcontroller1=[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller1]; uinavigationcontroller *navcontroller2=[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller2]; uinavigationcontroller *navcontroller3=[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller3]; uinavigationcontroller *navcontroller4 =[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller4]; uinavigationcontroller *navcontroller5 =[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller5]; viewcontroller1.title = @"home"; viewcontroller2.title = @"speciality"; viewcontroller3.title = @"activity"; viewcontroller4.title = @"notification"; viewcontroller5.title = @"profile"; navcontroller1.tabbaritem.image = [uiimage imagenamed:@"home"]; navcontroller2.tabbaritem.image = [uiimage imagenamed:@"special"]; navcontroller3.tabbaritem.image = [uiimage imagenamed:@"activity"]; navcontroller4.tabbaritem.image = [uiimage imagenamed:@"notify"]; navcontroller5.tabbaritem.image = [uiimage imagenamed:@"pro"]; self.this = [[uitabbarcontroller alloc] init]; self.this.viewcontrollers=[nsarray arraywithobjects:navcontroller1,navcontroller2,navcontroller3,navcontroller4,navcontroller5, nil]; self.this.tabbar.bartintcolor = rgbcolor(249, 178, 131); self.viewcontroller.centerpanel = _this; [self.window makekeyandvisible]; return yes; }
here, set window's root controller navigation controller:
self.window.rootviewcontroller = navigation;
and go on instantiate handful of other nav controllers , add them tab controller. it's not clear question you're trying achieve, if want app use tab controller, you'll want set window's root controller tab controller, not navigation controller.
Comments
Post a Comment