Use drawer effect in Swift project based on Mmdrawercontroller

Source: Internet
Author: User

Ready to use Swift to make a project, use this style. Sleep well at night. Dark Circles (--)

See details please visit my Githubhttps://github.com/zhangjingwang1993/swiftapp
You can also order a star and give an encouragement.
SWIFT/OC Advanced AC Group: 498143780

// AppDelegate.swiftvar drawer = MMDrawerController()
Let Leftviewcontroller = Leftviewcontroller () Let Rightviewcontroller = Rightviewcontroller () let Centerview Controller = Viewcontroller () Let Centernav = Uinavigationcontroller. Init(Rootviewcontroller:centerviewcontroller)//Set left and right controller drawer = Mmdrawercontroller. Init(Centerviewcontroller:centernav, Leftdrawerviewcontroller:leftviewcontroller, Rightdrawerviewcontroller: Rightviewcontroller)//SIDE Pull distance drawer. Maximumleftdrawerwidth=0.7* Width Drawer. Maximumrightdrawerwidth=0.7* Width//gesture drawer. Opendrawergesturemodemask= Mmopendrawergesturemode. AllDrawer. Closedrawergesturemodemask= Mmclosedrawergesturemode. AllSet animation here is set to open sidebar transparency from0To1Drawer. Setdrawervisualstateblock{(Drawercontroller, drawerside, percentvisible), Voidinchvar sidedrawerviewcontroller:uiviewcontroller? if (drawerside = = Mmdrawerside. Left) {Sidedrawerviewcontroller = Drawercontroller. Leftdrawerviewcontroller;} if (drawerside = = Mmdrawerside. Left) {Sidedrawerviewcontroller = Drawercontroller. Rightdrawerviewcontroller;} Sidedrawerviewcontroller?. View. Alpha= percentvisible} self. Window?. Rootviewcontroller= Drawer
In the left-hand VC TableView in the click Method
Func TableView (Tableview:uitableview, Didselectrowatindexpath Indexpath:nsindexpath) {Switch(Indexpath.row) { Case 0: LetCenterviewcontroller = Viewcontroller () LetCenternavigationcontroller = Uinavigationcontroller (Rootviewcontroller:centerviewcontroller) LetAppdelegate = Uiapplication.sharedapplication ().Delegate  as! Appdelegate AppDelegate.drawer.centerViewController = Centernavigationcontroller appdelegate.drawer. Toggledrawerside (Mmdrawerside.left, animated:true, Completion:nil)default: LetOtherviewcontroller = Testviewcontroller () LetOthernavigationcontroller = Uinavigationcontroller (Rootviewcontroller:otherviewcontroller) LetAppdelegate = Uiapplication.sharedapplication ().Delegate  as! Appdelegate AppDelegate.drawer.centerViewController = Othernavigationcontroller appdelegate.drawer.t Oggledrawerside (Mmdrawerside.left, animated:true, Completion:nil)}}

Use drawer effect in Swift project based on Mmdrawercontroller

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.