iOS 侧拉抽屉效果mmdrawercontroller剑客篇(欢迎提建议和分享经验)
2014-12-11 11:36
330 查看
iOS侧拉栏抽屉效果Demo
源码下载http://www.okbase.net/file/item/23015侧拉栏抽屉效果Demo
需要导入第三方的类库如下:
抽屉效果所需第三方类库下载
效果:既可以两侧都实现抽屉效果也可只实现左侧栏或者右侧栏的抽屉效果
关于抽屉效果主要是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]; //抽屉管理 第三方 //该第三方既可以只实现打开左侧栏也可以实现打开右侧栏,还可以同时都实现 MMDrawerController *rooVC = [[MMDrawerController alloc] initWithCenterViewController:navigationVC leftDrawerViewController:leftNavigationVC rightDrawerViewController:rightNavigationVC]; //只实现打开左侧栏 //MMDrawerController *rooVCLeft = [[MMDrawerController alloc] initWithCenterViewController:navigationVC leftDrawerViewController:firstVC]; //只实现打开右侧栏 //MMDrawerController *rooVCRight = [[MMDrawerController alloc] initWithCenterViewController:navigationVC rightDrawerViewController:thirdVC]; //指定window的根视图 self.window.rootViewController = rooVC; //测了门的宽度 [rooVC setMaximumLeftDrawerWidth:270]; //设置侧拉门开与关的动画 [rooVC setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll]; [rooVC setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll]; //侧开内容展示效果 //设置向左滑动打开右侧栏 [[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:MMDrawerAnimationTypeNone]; //设置向右滑动打开左侧栏 [[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 两种方式实现瀑布流效果剑客篇(欢迎提建议和分享经验)
- iOS 实现刮刮乐效果demo剑客篇(欢迎提建议和分享经验)
- iOS 插件管理工具之Alcatraz插件剑客篇(欢迎提建议和分享经验)
- iOS 真机测试之初级剑童篇较新版(欢迎提建议和分享经验)
- iOS 开发使用半透明模糊效果方法整理(欢迎分享和提建议)
- iOS UITableViewCell重用机制理解之初级剑侠篇(欢迎提建议和分享遇到的问题)
- iOS 防止崩溃之代码保护注意措施初级剑侠篇(欢迎提建议和分享遇到的问题)
- iOS 图片缓存框架SDWebImage使用方法(欢迎提建议和分享遇到的问题)
- iOS 开发抽屉效果 MMDrawerController
- iOS 系统控件UITableView使用之初级剑童篇(欢迎提建议和分享遇到的问题)
- iOS UITableView下拉刷新上拉加载更多MJRefresh类库(推荐)使用初级剑侠篇(欢迎提建议和分享遇到的问题)
- iOS 网络请求框架AFNetworking使用方法(欢迎提建议和分享遇到的问题)
- iOS 浅淡自动布局剑童篇(欢迎提意见和分享经验)
- IOS中MMDrawerController第三方抽屉效果的基本使用示例
- iOS 语法之Blocks使用初级剑童篇(欢迎提建议和分享遇到的问题)
- iOS 控件之UITextField及键盘挡住处理方法(欢迎大家提建议和分享)
- iOS 网络请求框架MKNetworkKit使用方法(欢迎提建议和分享遇到的问题)
- iOS抽屉效果开发案例分享
- 转载:App Store生存法则:iOS开发者经验分享
- App Store生存:iOS开发者经验分享