ios - Using MMDrawer within existing navigation controller -
i trying implement mmdrawer implement left drawer in 1 view controller , not root controller. on click of login button should able redirect view controller having left drawer , centre view
almost similar question using mmdrawer in sub navigation view
-(void) signinbuttonlistener:(uibutton *)button{ uiviewcontroller * leftdrawer = [[leftdrawerviewcontroller alloc] init]; uiviewcontroller * center = [[centreviewcontroller alloc] init]; mmdrawercontroller * drawercontroller = [[mmdrawercontroller alloc] initwithcenterviewcontroller:center leftdrawerviewcontroller:leftdrawer rightdrawerviewcontroller:nil]; [drawercontroller setshowsshadow:no]; [drawercontroller setrestorationidentifier:@"mmdrawer"]; [drawercontroller setmaximumrightdrawerwidth:200.0]; [drawercontroller setopendrawergesturemodemask:mmopendrawergesturemodeall]; [drawercontroller setclosedrawergesturemodemask:mmclosedrawergesturemodeall]; [drawercontroller setdrawervisualstateblock:^(mmdrawercontroller *drawercontroller, mmdrawerside drawerside, cgfloat percentvisible) { mmdrawercontrollerdrawervisualstateblock block; block = [[mmexampledrawervisualstatemanager sharedmanager] drawervisualstateblockfordrawerside:drawerside]; if(block){ block(drawercontroller, drawerside, percentvisible); } }]; landingpageviewcontroller *landingpagecontroller = [ubnlandingpageviewcontroller new]; [mynavigator pushviewcontroller:drawercontroller animated:yes]; }
in appdelegate.h
@property (strong, nonatomic) mmdrawercontroller *drawer;
in appdelegate.m file inside:
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { uistoryboard *mainstory=[uistoryboard storyboardwithname:@"main" bundle:nil]; uiviewcontroller * leftdrawer = [mainstory instantiateviewcontrollerwithidentifier:@"menutableviewcontroller"]; uiviewcontroller * center = [mainstory instantiateviewcontrollerwithidentifier:@"homeviewcontroller"]; uinavigationcontroller *leftnav=[[uinavigationcontroller alloc]initwithrootviewcontroller:leftdrawer]; uinavigationcontroller *homnav=[[uinavigationcontroller alloc]initwithrootviewcontroller:center]; //drawer object mmdrawercontroller drawer=[[mmdrawercontroller alloc]initwithcenterviewcontroller:homnav leftdrawerviewcontroller:leftnav rightdrawerviewcontroller:nil];
//dont write
_window.rootviewcontroller=drawcontroller; [_window makekeyandvisible]; comment these lines if write.
in ur loginbuttonaction
import appdelegate.h file , write inside these lines u centre view next page.
appdelegate *app=(appdelegate *)[[uiapplication sharedapplication]delegate]; app.window.rootviewcontroller = app.drawer; [app.window makekeyandvisible];
Comments
Post a Comment