国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > iOS > 正文

iOS實(shí)現(xiàn)側(cè)拉欄抽屜效果

2020-07-26 03:27:15
字體:
供稿:網(wǎng)友

本文實(shí)例介紹了iOS實(shí)現(xiàn)側(cè)拉欄抽屜效果的相關(guān)代碼,分享給大家供大家參考,具體內(nèi)容如下

需要導(dǎo)入第三方的類庫如下:

抽屜效果所需第三方類庫下載

效果:既可以兩側(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; //測了門的寬度 [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>

以上就是本文的全部內(nèi)容,希望對(duì)大家學(xué)習(xí)ios抽屜效果有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 靖西县| 绥宁县| 大港区| 得荣县| 图们市| 都安| 常德市| 新蔡县| 清水县| 安达市| 九江市| 泾源县| 丰镇市| 日土县| 芒康县| 沐川县| 上虞市| 化隆| 钦州市| 八宿县| 大名县| 监利县| 望都县| 民权县| 晋州市| 成安县| 富川| 沁水县| 偏关县| 梅河口市| 常山县| 北宁市| 任丘市| 瑞安市| 娱乐| 汾西县| 无为县| 陆川县| 临颍县| 玛多县| 彰化市|