objective c - Issue in adding UIContainerveiw to SlideViewNavigation in StoryBoard iOS -
i trying add persistent button @ bottom of view via uicontainerview in storyboard on slidenavigationcontroller.
but getting blank view on navigation of left slide out(where working fine list of table contents on left slide out out container view) (used third party tool ios-slide-menu )
storyboard
code mainpageviewcontroller
- (void)viewdidload { [super viewdidload]; uistoryboard *mainstoryboard = [uistoryboard storyboardwithname:@"main" bundle: nil]; [[parseservicemanager getinstance] initializeparse]; [slidenavigationcontroller sharedinstance].leftmenu = [[uinavigationcontroller alloc] initwithrootviewcontroller:[[leftmenuviewcontroller alloc] init]];; [slidenavigationcontroller sharedinstance].rightmenu = [[uinavigationcontroller alloc] initwithrootviewcontroller:[[rightmenuviewcontroller alloc] init]]; [slidenavigationcontroller sharedinstance].menurevealanimationduration = .18; [slidenavigationcontroller sharedinstance].enableswipegesture = false; [[nsnotificationcenter defaultcenter] addobserverforname:slidenavigationcontrollerdidclose object:nil queue:nil usingblock:^(nsnotification *note) { nsstring *menu = note.userinfo[@"menu"]; nslog(@"closed %@", menu); }]; [[nsnotificationcenter defaultcenter] addobserverforname:slidenavigationcontrollerdidopen object:nil queue:nil usingblock:^(nsnotification *note) { nsstring *menu = note.userinfo[@"menu"]; nslog(@"opened %@", menu); }]; [[nsnotificationcenter defaultcenter] addobserverforname:slidenavigationcontrollerdidreveal object:nil queue:nil usingblock:^(nsnotification *note) { nsstring *menu = note.userinfo[@"menu"]; nslog(@"revealed %@", menu); }]; }
warning in console as:
slidenavigationcontroller has not been initialized. either place 1 in storyboard or initialize 1 in code
if 1 have faced similar issue initialise slide-navigation in customviewcontroller instead of app delegate, please me in solving this!
i didn't add uinavigationcontroller(slidenavigationcontroller) in storyboard plz refer screenshot initialized programmatically below
push loginview slidenavigationcontroller appdelegate
uistoryboard *mainstoryboard = [uistoryboard storyboardwithname:@"mainstoryboard_iphone" bundle: nil]; loginviewcontroller *loginview = (loginviewcontroller*)[mainstoryboard instantiateviewcontrollerwithidentifier: @"loginviewcontroller"]; [loginview setmodalpresentationstyle:uimodaltransitionstylecrossdissolve]; slidenavigationcontroller * slidenavctl = [[slidenavigationcontroller alloc] initwithrootviewcontroller:loginview]; [self.window setrootviewcontroller:slidenavctl];
push homeview slidenavigationcontroller appdelegate
uistoryboard *mainstoryboard = [uistoryboard storyboardwithname:@"mainstoryboard_iphone" bundle: nil]; homeviewcontroller *homeview = (homeviewcontroller*)[mainstoryboard instantiateviewcontrollerwithidentifier:@"homeviewcontroller"]; [homeview setmodalpresentationstyle:uimodaltransitionstylecrossdissolve]; slidenavigationcontroller * slidenavctl = [[slidenavigationcontroller alloc] initwithrootviewcontroller:homeview]; [self.window setrootviewcontroller:slidenavctl]; leftmenuviewcontroller *leftmenu2 = (leftmenuviewcontroller*)[mainstoryboard instantiateviewcontrollerwithidentifier: @"leftmenuviewcontroller"]; [slidenavigationcontroller sharedinstance].leftmenu = leftmenu2;
after login loginview push homeview view leftmenuviewcontroller or sidebarviewcontroller
if(login){ uistoryboard *mainstoryboard = [uistoryboard storyboardwithname:@"mainstoryboard_iphone" bundle: nil]; uiviewcontroller *vc = [mainstoryboard instantiateviewcontrollerwithidentifier: @"homeviewcontroller"]; -----this important ,you need assign ur leftmenu or sidebarviewcontroller here----------------- leftmenuviewcontroller *leftmenu2 = (leftmenuviewcontroller*)[mainstoryboard instantiateviewcontrollerwithidentifier: @"leftmenuviewcontroller"]; [slidenavigationcontroller sharedinstance].leftmenu = leftmenu2; ------------------------------ [[slidenavigationcontroller sharedinstance] pushviewcontroller:vc animated:yes]; }else { nslog(@"login update failed") }
Comments
Post a Comment