iOS實(shí)現(xiàn)側(cè)拉欄抽屜效果
本文實(shí)例介紹了iOS實(shí)現(xiàn)側(cè)拉欄抽屜效果的相關(guān)代碼,分享給大家供大家參考,具體內(nèi)容如下
需要導(dǎo)入第三方的類庫(kù)如下:
抽屜效果所需第三方類庫(kù)下載
效果:既可以兩側(cè)都實(shí)現(xiàn)抽屜效果也可只實(shí)現(xiàn)左側(cè)欄或者右側(cè)欄的抽屜效果
關(guān)于抽屜效果主要是AppDelegate的代碼
AppDelegate.h文件代碼:
<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文件代碼 <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]]; //主視圖 FirstViewController *firstVC = [[FirstViewController alloc] init]; //左邊視圖 SecondViewController *secondVC = [[SecondViewController alloc] init]; //右邊視圖 ThirdViewController *thirdVC = [[ThirdViewController alloc] init]; CustomizedNavigationController *navigationVC = [[CustomizedNavigationController alloc] initWithRootViewController:firstVC]; CustomizedNavigationController *leftNavigationVC = [[CustomizedNavigationController alloc] initWithRootViewController:secondVC]; CustomizedNavigationController *rightNavigationVC = [[CustomizedNavigationController alloc] initWithRootViewController:thirdVC]; //抽屜管理 第三方 //該第三方既可以只實(shí)現(xiàn)打開左側(cè)欄也可以實(shí)現(xiàn)打開右側(cè)欄,還可以同時(shí)都實(shí)現(xiàn) MMDrawerController *rooVC = [[MMDrawerController alloc] initWithCenterViewController:navigationVC leftDrawerViewController:leftNavigationVC rightDrawerViewController:rightNavigationVC]; //只實(shí)現(xiàn)打開左側(cè)欄 //MMDrawerController *rooVCLeft = [[MMDrawerController alloc] initWithCenterViewController:navigationVC leftDrawerViewController:firstVC]; //只實(shí)現(xiàn)打開右側(cè)欄 //MMDrawerController *rooVCRight = [[MMDrawerController alloc] initWithCenterViewController:navigationVC rightDrawerViewController:thirdVC]; //指定window的根視圖 self.window.rootViewController = rooVC; //測(cè)了門的寬度 [rooVC setMaximumLeftDrawerWidth:270]; //設(shè)置側(cè)拉門開與關(guān)的動(dòng)畫 [rooVC setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll]; [rooVC setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll]; //側(cè)開內(nèi)容展示效果 //設(shè)置向左滑動(dòng)打開右側(cè)欄 [[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:MMDrawerAnimationTypeNone]; //設(shè)置向右滑動(dòng)打開左側(cè)欄 [[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>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家學(xué)習(xí)ios抽屜效果有所幫助。
- iOS開發(fā)之路--仿網(wǎng)易抽屜效果
- IOS中MMDrawerController第三方抽屜效果的基本使用示例
- iOS實(shí)現(xiàn)簡(jiǎn)單的抽屜效果
- IOS中Swift仿QQ最新版抽屜側(cè)滑和彈框視圖
- iOS實(shí)現(xiàn)左右拖動(dòng)抽屜效果
- IOS實(shí)現(xiàn)點(diǎn)擊滑動(dòng)抽屜效果
- ios仿側(cè)邊抽屜效果實(shí)現(xiàn)代碼
- iOS實(shí)現(xiàn)簡(jiǎn)單抽屜效果
- iOS實(shí)現(xiàn)簡(jiǎn)易抽屜效果、雙邊抽屜效果
- iOS簡(jiǎn)單抽屜效果的實(shí)現(xiàn)方法
相關(guān)文章
iOS中tableView cell分割線的一些設(shè)置技巧
在項(xiàng)目開發(fā)中我們會(huì)常常遇到tableView 的cell分割線顯示不全,左邊會(huì)空出一截像素,更有甚者想改變系統(tǒng)的分割線,下面通過這篇文章來一起學(xué)習(xí)學(xué)習(xí)在iOS中tableView cell分割線的一些設(shè)置技巧,需要的朋友可以參考借鑒,下面來一起看看吧。2017-05-05iOS APP中保存圖片到相冊(cè)時(shí)崩潰的解決方法
下面小編就為大家分享一篇iOS APP中保存圖片到相冊(cè)時(shí)崩潰的解決方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2017-12-12iOS評(píng)分(評(píng)價(jià))星星圖打分功能
這篇文章主要介紹了iOS評(píng)分(評(píng)價(jià))星星圖打分功能,評(píng)分視圖分為展示和評(píng)分兩種,具體詳情大家可以通過本文詳細(xì)學(xué)習(xí)2016-11-11iOS 數(shù)據(jù)結(jié)構(gòu)之?dāng)?shù)組的操作方法
這篇文章主要介紹了iOS 數(shù)據(jù)結(jié)構(gòu)之?dāng)?shù)組的操作方法,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2018-07-07iOS漸變圓環(huán)旋轉(zhuǎn)動(dòng)畫CAShapeLayer CAGradientLayer
這篇文章主要介紹了iOS漸變圓環(huán)旋轉(zhuǎn)動(dòng)畫CAShapeLayer CAGradientLayer的相關(guān)資料,需要的朋友可以參考下2016-09-09iOS通過Runtime實(shí)現(xiàn)友盟統(tǒng)計(jì)的實(shí)例代碼
本篇文章主要介紹了iOS通過Runtime實(shí)現(xiàn)友盟統(tǒng)計(jì)的實(shí)例代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-06-06以代碼實(shí)例總結(jié)iOS應(yīng)用開發(fā)中數(shù)據(jù)的存儲(chǔ)方式
這篇文章主要介紹了iOS應(yīng)用開發(fā)中數(shù)據(jù)的存儲(chǔ)方式的實(shí)例總結(jié),代碼為傳統(tǒng)的Objective-C語言,需要的朋友可以參考下2016-02-02iOS 11 UINavigationItem 去除左右間隙的方法
本篇文章主要介紹了iOS 11 UINavigationItem 去除左右間隙的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-10-10