Mmdrawercontroller
1,
Integration
Rightdrawerviewcontroller:rightdrawer];
Detailed code
TABVC = [[Tabbarcontroller alloc]init];
Left page frame
Leftpage *leftcontroller = [[Leftpage alloc] init];
Self.drawercontroller = [[Mmdrawercontroller alloc]
Initwithcenterviewcontroller:tabvc
Leftdrawerviewcontroller:leftcontroller
Rightdrawerviewcontroller:nil];
[Self.drawercontroller Setshowsshadow:no];
[Self.drawercontroller setrestorationidentifier:@ "Mmdrawer"];
[Self.drawercontroller setmaximumleftdrawerwidth:260.0];
Self.drawerController.visibleLeftDrawerWidth = 260;
[Self.drawercontroller Setopendrawergesturemodemask:mmopendrawergesturemodeall];
[Self.drawercontroller Setclosedrawergesturemodemask:mmclosedrawergesturemodeall];
Slip-on launch style
[[Mmexampledrawervisualstatemanager Sharedmanager] setleftdraweranimationtype:1];
[Self.drawercontroller
setdrawervisualstateblock:^ (Mmdrawercontroller *drawercontroller, Mmdrawerside drawerside, CGFloat percentVisible) {
Mmdrawercontrollerdrawervisualstateblock Block;
block = [[Mmexampledrawervisualstatemanager Sharedmanager]
Drawervisualstateblockfordrawerside:drawerside];
if (block) {
Block (Drawercontroller, drawerside, percentvisible);
}
}];
[Self.window SetRootViewController:self.drawerController];
Redefining the top left button event in the main interface
-(void) leftbtnpressed
{
[[(Appdelegate *) [[uiapplication Sharedapplication] delegate] Menucontroller] Showleftcontroller:yes];
[Self.mm_drawercontroller toggledrawerside:mmdrawersideleft Animated:yes Completion:nil];
}
When you click on the left Avatar to return to the main interface, you want to go back to the main screen, the demo is re-created a new one that is not available in the project.
2, when the main interface into the level two page, want to remove the gesture. Achieve customization.
In
MMDrawerController.h add
/* 2016-5-10 MXT Add
Open gesture swipe out menu */
@property (assign,nonatomic) BOOL needswipeshowmenu;//whether to open gesture swipe out menu
MMDRAWERCONTROLLER.M add
#pragma mark-helpers
-(void) setupgesturerecognizers{
Pan = [[Uipangesturerecognizer alloc] initwithtarget:self action: @selector (Pangesturecallback:)];
[Pan setdelegate:self];
[Self.view Addgesturerecognizer:pan];
Tap = [[UITapGestureRecognizer alloc] initwithtarget:self action: @selector (Tapgesturecallback:)];
[Tap setdelegate:self];
[Self.view Addgesturerecognizer:tap];
}
Rewrite sett
-(void) Setneedswipeshowmenu: (BOOL) needswipeshowmenu{
_needswipeshowmenu = Needswipeshowmenu;
if (Needswipeshowmenu) {
NSLog (@ "--------Needswipeshowmenu----------------------------------yes");
[Self.view Addgesturerecognizer:pan];
}else{
NSLog (@ "--------needswipeshowmenu----------------------------------No");
[Self.view Removegesturerecognizer:pan];
}
}
Add on the page you use
-(void) Viewdidappear: (BOOL) animated
{
[Super viewdidappear:animated];
NSLog (@ "Mine viewdidappear yes");
KAPPDelegate.drawerController.needSwipeShowMenu = YES;
}
-(void) Viewwilldisappear: (BOOL) animated
{
KAPPDelegate.drawerController.needSwipeShowMenu = NO;
}
Mmdrawercontroller use of problems and customization