IOS-Side Pull bar drawer effect Demo and ios-side drawer demo

Source: Internet
Author: User

IOS-Side Pull bar drawer effect Demo and ios-side drawer demo


Source code download

Side pane drawer effect Demo
The third-party class libraries to be imported are as follows:


Download third-party class libraries required for drawer Effects



Effect: You can achieve the drawer effect on both sides or the drawer effect on the Left or Right bar.




The drawer effect is mainly the code of AppDelegate.

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 didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {self. window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]; // FirstViewController * firstVC = [[FirstViewController alloc] init] in the main view; // SecondViewController * secondVC = [[SecondViewController alloc] init]; // ThirdViewController * thirdVC = [[ThirdViewController alloc] init] In the right view; using * navigationVC = [[CustomizedNavigationController alloc] Using: firstVC]; CustomizedNavigationController * using = [[using alloc] Using: secondVC]; using * rightNavigationVC = [[[CustomizedNavigationController alloc] using: thirdVC]; // drawer management third party // This third party can open either the left sidebar or the right sidebar, you can also implement both MMDrawerController * rooVC = [[MMDrawerController alloc] initWithCenterViewController: navigationVC leftDrawerViewController: leftNavigationVC rightDrawerViewController: rightNavigationVC]; // open the left sidebar only. // MMDrawerController * rooVCLeft = [[MMDrawerController alloc] initWithCenterViewController: navigationVC leftDrawerViewController: firstVC]; // open the right column only. // MMDrawerController * rooVCRight = [[MMDrawerController alloc] initWithCenterViewController: navigationVC rightDrawerViewController: thirdVC]; // specify the window Root View self. window. rootViewController = rooVC; // tested the door width [rooVC setMaximumLeftDrawerWidth: 270]; // set the animation for side trim Opening and Closing [rooVC setOpenDrawerGestureModeMask: unlock]; [rooVC trim: MMCloseDrawerGestureModeAll]; // The displayed content is displayed. // sliding left to open the right column [[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType: MMDrawerAnimationTypeNone]; // set to slide to the right to open the left sidebar [[sharesharedmanager] role: role]; // [rooVC setDrawerVisualStateBlock: ^ (MMDrawerController * drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {distributed block; block = [[MMExampleDrawerVisualStateManager sharedManager] drawerVisualStateBlockForDrawerSide: drawerSide]; if (block) {block (drawerController, drawerSide, percentVisible) ;}}]; self. window. backgroundColor = [UIColor whiteColor]; [self. window makeKeyAndVisible]; return YES ;}</span> </span>



How does the ios drawer effect determine the external area of the drawer? How to remove help

You can put your drawer in a view to know the Coordinate Position of the current view in your Vc. You can judge that the current view is not available in this area to view the original post>

How to Implement drawer interaction menus like Netease iOS clients in ios

Similar to Netease's interactive network, there is a dedicated Demo, PPRevealSideViewController

Related Article

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.