SOURCE download
Drawer effect third-party class library download
Required third-party class library download
Drawer side pull-out bar
header files that need to be imported:
#import "MMDrawerController.h" #import "MMExampleDrawerVisualStateManager.h"
Code implementation:
First you need to create three attempt controllers
Main view Firstviewcontroller *FIRSTVC = [[Firstviewcontroller alloc] init]; Left view Secondviewcontroller *SECONDVC = [[Secondviewcontroller alloc] init]; Right view Thirdviewcontroller *THIRDVC = [[Thirdviewcontroller alloc] init]; Customizednavigationcontroller *NAVIGATIONVC = [[Customizednavigationcontroller alloc] Initwithrootviewcontroller: FIRSTVC]; Customizednavigationcontroller *LEFTNAVIGATIONVC = [[Customizednavigationcontroller alloc] INITWITHROOTVIEWCONTROLLER:SECONDVC]; Customizednavigationcontroller *RIGHTNAVIGATIONVC = [[Customizednavigationcontroller alloc] INITWITHROOTVIEWCONTROLLER:THIRDVC]; Drawer Management Third party//The third party can only implement open the left sidebar can also be implemented to open the right column, but also can be implemented mmdrawercontroller *ROOVC = [[Mmdrawercontroller alloc] Initwithcent ERVIEWCONTROLLER:NAVIGATIONVC LEFTDRAWERVIEWCONTROLLER:LEFTNAVIGATIONVC Rightdrawerviewcontroller: RIGHTNAVIGATIONVC]; Only implement open left column//mmdrawercontroller *roovcleft = [[Mmdrawercontroller alloc] Initwithcenterviewcontroller:navigatIONVC LEFTDRAWERVIEWCONTROLLER:FIRSTVC]; Only implement open right column//mmdrawercontroller *roovcright = [[Mmdrawercontroller alloc] Initwithcenterviewcontroller:navigationvc RIGHTDRAWERVIEWCONTROLLER:THIRDVC]; Specifies the window's root view Self.window.rootViewController = ROOVC; The width of the door was measured [ROOVC setmaximumleftdrawerwidth:270]; Set the side door open and close animation [ROOVC Setopendrawergesturemodemask:mmopendrawergesturemodeall]; [ROOVC Setclosedrawergesturemodemask:mmclosedrawergesturemodeall]; Side open content Display//settings swipe left to open the right column [[Mmexampledrawervisualstatemanager Sharedmanager] Setrightdraweranimationtype: Mmdraweranimationtypenone]; Set swipe right to open the left column [[Mmexampledrawervisualstatemanager Sharedmanager] Setleftdraweranimationtype: Mmdraweranimationtypenone]; [ROOVC setdrawervisualstateblock:^ (Mmdrawercontroller *drawercontroller, Mmdrawerside drawerSide, CGFloat Percentvisible) {Mmdrawercontrollerdrawervisualstateblock block; block = [[Mmexampledrawervisualstatemanager Sharedmanager] Drawervisualstateblockfordrawerside:drawerside]; if (block) {block (Drawercontroller, drawerside, percentvisible); } }];
iOS drawer effect