ios - Set up side drawer controller -
basically use mmdrawerviewcontroller
side drawer , setup storyboard prototype below
and code successful login
uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; menuvc *menuviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"menuvc"]; uiviewcontroller *centerviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"vc1"]; mmdrawercontroller *drawer = [[mmdrawercontroller alloc] initwithcenterviewcontroller:centerviewcontroller leftdrawerviewcontroller:menuviewcontroller]; ((vc1 * )centerviewcontroller).drawer = drawer; menuviewcontroller.drawer = drawer; [drawer setrestorationidentifier:@"mmdrawer"]; [drawer setopendrawergesturemodemask:mmopendrawergesturemodeall]; [drawer setclosedrawergesturemodemask:mmclosedrawergesturemodeall]; [drawer setdrawervisualstateblock:^(mmdrawercontroller *drawercontroller, mmdrawerside drawerside, cgfloat percentvisible) { mmdrawercontrollerdrawervisualstateblock block; block = [[mmexampledrawervisualstatemanager sharedmanager] drawervisualstateblockfordrawerside:drawerside]; if(block){ block(drawercontroller, drawerside, percentvisible); } }]; [self.navigationcontroller pushviewcontroller:drawer animated:yes];
problem
when login , push vc1
gives me button(obviously because pushed through nav1
)..and if trying hide not able it...don't know why.
so question how can change navigation controller after pushed other navigation controller push nav1 , vc1
want change navigation controller nav2
, if not possible how setup drawer?
note: using
mmdrawerviewcontroller
can suggest me other drawer controller rid of
in appdelegate
uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; uinavigationcontroller *navcontroller; if (i have user data) navcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"nav1"]; } else { navcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"nav2"]; } [self.window setrootviewcontroller:navcontroller];
so, idea...how resolve this?
in code took away navigation controller @ because on mmdrawer set programatically. code:
var rootviewcontroller = self.window!.rootviewcontroller let mainstoryboard: uistoryboard = uistoryboard(name: "main", bundle: nil) var centerviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("loginpageviewcontroller") loginpageviewcontroller //var rootviewcontroller = centerviewcontroller var leftviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("sidebartableviewcontroller") sidebartableviewcontroller var leftsidenav = uinavigationcontroller(rootviewcontroller: leftviewcontroller) var centersidenav = uinavigationcontroller(rootviewcontroller: centerviewcontroller) centercontainer = mmdrawercontroller(centerviewcontroller: centersidenav, leftdrawerviewcontroller: leftviewcontroller) centercontainer!.opendrawergesturemodemask = mmopendrawergesturemode.panningcenterview // centercontainer!.opendrawergesturemodemask = mmopendrawergesturemode.none centercontainer!.closedrawergesturemodemask = mmclosedrawergesturemode.panningcenterview window!.rootviewcontroller = centercontainer window!.makekeyandvisible()
you have navigation controller. second issue on viewcontroller comes after login view controller set navigation bar ! need hide common navigation bar , show navigation bar set manually!
Comments
Post a Comment