objective c - How to add slide navigation in ios in nib file -
i facing problem add slide navigation in nib file. please me
i have example story board , want use in nib can open menu form left side
[slidenavigationcontroller sharedinstance].rightmenu = rightmenu; [slidenavigationcontroller sharedinstance].menurevealanimationduration = .18; // creating custom bar button right menu uibutton *button = [[uibutton alloc] initwithframe:cgrectmake(0, 0, 30, 30)]; [button setimage:[uiimage imagenamed:@"gear"] forstate:uicontrolstatenormal]; [button addtarget:[slidenavigationcontroller sharedinstance] action:@selector(togglerightmenu) forcontrolevents:uicontroleventtouchupinside]; uibarbuttonitem *rightbarbuttonitem = [[uibarbuttonitem alloc] initwithcustomview:button]; [slidenavigationcontroller sharedinstance].rightbarbuttonitem = rightbarbuttonitem; slidenavigationcontroller *nav = [[slidenavigationcontroller alloc] initwithrootviewcontroller:viewcon]; nav.navigationbarhidden=yes; self.window.rootviewcontroller=nav; [self.window makekeyandvisible];
create leftmenuviewcontroller
xib , implementation , header file. in end should have these filed:
leftmenuviewcontroller.h leftmenuviewcontroller.m leftmenuviewcontroller..xib
and replace line
leftmenuviewcontroller *leftmenu = (leftmenuviewcontroller*)[mainstoryboard instantiateviewcontrollerwithidentifier: @"leftmenuviewcontroller"];
with - load controller xib
leftmenuviewcontroller *sm = [[a1sidemenuviewcontroller alloc]initwithnibname:@"leftmenuviewcontroller" bundle:nil];
Comments
Post a Comment