iOS side pull Drawer effect Demo

Source: Internet
Author: User



Source Download

Side Pull Drawer effect Demo
you need to import a third-party class library as follows:


Drawer effect required third-party class library download



effect: The drawer effect can be achieved on both sides or only in the left column or the right side of the drawer.




about the drawer effect is mainly appdelegate code

AppDelegate.h file Code:

<span style= "FONT-SIZE:18PX;" ><span style= "FONT-SIZE:18PX;" > #import <UIKit/UIKit.h> @interface yjfappdelegate:uiresponder <UIApplicationDelegate> @property ( Strong, nonatomic) UIWindow *window; @end </span></span>

appdelegate.m File Code

<span style= "FONT-SIZE:18PX;" ><span style= "FONT-SIZE:24PX;" ><span style= "FONT-SIZE:18PX;" > #import "YJFAppDelegate.h" #import "CustomizedNavigationController.h" #import "FirstViewController.h" #import " SecondViewController.h "#import" ThirdViewController.h "@implementation yjfappdelegate-(BOOL) Application: ( UIApplication *) Application didfinishlaunchingwithoptions: (nsdictionary *) launchoptions{Self.window = [[UIWindow]    Alloc] Initwithframe:[[uiscreen mainscreen] bounds];    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 sidebar  [[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);            }    }];    Self.window.backgroundColor = [Uicolor Whitecolor];    [Self.window makekeyandvisible]; return YES;} </span></span></span>


iOS side pull Drawer effect Demo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.