Use the MMDrawerController side drawer push page

A recent demand in the development of the page structure before UITabBarController administration, into a drawer effect, so I use the open source MMDrawerController framework, GitHub address:
MMDrawerController specific usage, here is not detailed, we can refer to this article -iOS-MMDrawerController use. Our current requirement is left drawer open, click on the button above, push out of the next page, when the push out of the page pop back, the left drawer remains open.

The effect of simple integration of Use the MMDrawerController side drawer push page

this is obviously not the desired effect. Push pages should appear from the edge of the screen, right?! Just like the picture below:

Use the MMDrawerController side drawer push page
want the effect.Gif

I think the idea is when clicking on the PUSH button, the current screen shots, and then added to the left drawer of the View, while adjusting the drawer maximumLeftDrawerWidth as the width of the screen and remove the shadow. On the left side of the controller (void) – viewDidAppear: (BOOL) to remove the screenshots in the animated method, and maximumLeftDrawerWidth will revert to the initial width and restore the display shadow, so pop back page looks just like push before.

Just add a page screenshot - (void) addCurrentPageScreenshot UIImage [UIImage screenshot] {*screenImage = UIImageView; *imgView = [[UIImageView alloc] initWithImage:screenImage]; imgView.image = screenImage; [self.view addSubview:imgView]; self.coverImageView = imgView;} / / / set drawer status after view pop (void) - settingDrawerWhenPop [UIScreen {self.mm_drawerController.maximumLeftDrawerWidth = mainScreen].bounds.size.width - 50; self.mm_drawerController.showsShadow = YES; self.mm_drawerController.closeDrawerGestureModeMask = MMCloseDrawerGestureModeAll; [self.coverImageView removeFromSuperview]; self.coverImageView = nil;} / / / set drawer status after view push (void) - settingDrawerW HenPush {[self.mm_drawerController setMaximumLeftDrawerWidth:[UIScreen mainScreen].bounds.size.width]; self.mm_drawerController.showsShadow = NO; / / here must close gestures, otherwise hidden on the right side of the screen can be dragged out of drawer self.mm_drawerController.closeDrawerGestureModeMask = MMCloseDrawerGestureModeNone;}
- (void) viewDidAppear: (BOOL) animated viewDidAppear:animated] [self {[super; settingDrawerWhenPop];} - (void) gotoSetting: (UIButton * sender) {[self addCurrentPageScreenshot]; [self settingDrawerWhenPush]; SettingViewController * settingVc = [[SettingViewController alloc] init]; [self.navigationController pushViewController:settingVc animated:YES];}

– by the way of posting screenshots – –

#import "UIImage+Extension.h" @implementation UIImage (Extension) / / / screenshots + (UIImage *) screenshot imageSize mainScreen] bounds].size {CGSize = [[UIScreen; UIGraphicsBeginImageContextWithOptions (imageSize, NO, 0); CGContextRef (context = UIGraphicsGetCurrentContext); for (UIWindow *window in [[UIApplication sharedApplication] windows] ([window) {if! RespondsToSelector:@selector (screen)] || [window = = screen] [UIScreen mainScreen]) {CGContextSaveGState (context); CGContextTranslateCTM (context, [window center].x, [window center].y); CGContextConcatCTM (context, [window transform]); CGContextTranslateCTM (context, -[window bou Nds].size.width * [[window layer] anchorPoint].x * [[window layer] anchorPoint].y -[window, bounds].size.height); [[window layer] renderInContext:context]; CGContextRestoreGState (context);}} = UIGraphicsGetImageFromCurrentImageContext (UIImage *image); UIGraphicsEndImageContext (return); image @end;}

If you have other ways or ideas, discuss it together!
Demo code here,