11----MMDrawerConcroller的简单使用
2015-09-24 10:12
253 查看
学习的时间总是过得很快,虽然每一天的起床都很煎熬,但到教室后一天很快就过去了。时间越来越少,会的东西也越来越多,进入项目二的学习后,接触的第三方框架也越来越多,比如像项目二的大框架就是一个MMDrawerController,创建代码如下
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor clearColor];
//从故事板(storybord)中获取控制器对象
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
[[NSNotificationCenter defaultCenter]addObserver:selfselector:@selector(_setAnimation) name:kStyleNotification object:nil];
//设置左边的控制器
self.leftDrawerViewController = [storybord instantiateViewControllerWithIdentifier:@"LeftVC"];
//设置中间的控制器
self.centerViewController = [storybord instantiateViewControllerWithIdentifier:@"CenterVC"];
//设置右边的控制器
self.rightDrawerViewController = [storybord instantiateViewControllerWithIdentifier:@"RightVC"];
//设置阴影
[self setShowsShadow:YES];
//设置两边的宽度
[self setMaximumLeftDrawerWidth:160.0];
[self setMaximumRightDrawerWidth:60.0];
//设置手势的作用区域
[self setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[self setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
//配置动画的回调函数
[self setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
MMDrawerControllerDrawerVisualStateBlock block;
block = [[MMExampleDrawerVisualStateManagersharedManager]drawerVisualStateBlockForDrawerSide:drawerSide];
if (block) {
block(drawerController,drawerSide,percentVisible);
}
}];
//设置动画
[self _setAnimation];
}
//设置动画
- (void)_setAnimation
{
//从数据中拿到选中的样式
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSInteger style = [[defaults objectForKey:kAnimationStyle]integerValue];
//根据样式的枚举值设置动画
[[MMExampleDrawerVisualStateManager sharedManager] setLeftDrawerAnimationType:style];
[[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:style];
}
学习的时间总是过得很快,虽然每一天的起床都很煎熬,但到教室后一天很快就过去了。时间越来越少,会的东西也越来越多,进入项目二的学习后,接触的第三方框架也越来越多,比如像项目二的大框架就是一个MMDrawerController,创建代码如下
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor clearColor];
//从故事板(storybord)中获取控制器对象
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
[[NSNotificationCenter defaultCenter]addObserver:selfselector:@selector(_setAnimation) name:kStyleNotification object:nil];
//设置左边的控制器
self.leftDrawerViewController = [storybord instantiateViewControllerWithIdentifier:@"LeftVC"];
//设置中间的控制器
self.centerViewController = [storybord instantiateViewControllerWithIdentifier:@"CenterVC"];
//设置右边的控制器
self.rightDrawerViewController = [storybord instantiateViewControllerWithIdentifier:@"RightVC"];
//设置阴影
[self setShowsShadow:YES];
//设置两边的宽度
[self setMaximumLeftDrawerWidth:160.0];
[self setMaximumRightDrawerWidth:60.0];
//设置手势的作用区域
[self setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[self setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
//配置动画的回调函数
[self setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
MMDrawerControllerDrawerVisualStateBlock block;
block = [[MMExampleDrawerVisualStateManagersharedManager]drawerVisualStateBlockForDrawerSide:drawerSide];
if (block) {
block(drawerController,drawerSide,percentVisible);
}
}];
//设置动画
[self _setAnimation];
}
//设置动画
- (void)_setAnimation
{
//从数据中拿到选中的样式
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSInteger style = [[defaults objectForKey:kAnimationStyle]integerValue];
//根据样式的枚举值设置动画
[[MMExampleDrawerVisualStateManager sharedManager] setLeftDrawerAnimationType:style];
[[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:style];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor clearColor];
//从故事板(storybord)中获取控制器对象
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
[[NSNotificationCenter defaultCenter]addObserver:selfselector:@selector(_setAnimation) name:kStyleNotification object:nil];
//设置左边的控制器
self.leftDrawerViewController = [storybord instantiateViewControllerWithIdentifier:@"LeftVC"];
//设置中间的控制器
self.centerViewController = [storybord instantiateViewControllerWithIdentifier:@"CenterVC"];
//设置右边的控制器
self.rightDrawerViewController = [storybord instantiateViewControllerWithIdentifier:@"RightVC"];
//设置阴影
[self setShowsShadow:YES];
//设置两边的宽度
[self setMaximumLeftDrawerWidth:160.0];
[self setMaximumRightDrawerWidth:60.0];
//设置手势的作用区域
[self setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[self setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
//配置动画的回调函数
[self setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
MMDrawerControllerDrawerVisualStateBlock block;
block = [[MMExampleDrawerVisualStateManagersharedManager]drawerVisualStateBlockForDrawerSide:drawerSide];
if (block) {
block(drawerController,drawerSide,percentVisible);
}
}];
//设置动画
[self _setAnimation];
}
//设置动画
- (void)_setAnimation
{
//从数据中拿到选中的样式
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSInteger style = [[defaults objectForKey:kAnimationStyle]integerValue];
//根据样式的枚举值设置动画
[[MMExampleDrawerVisualStateManager sharedManager] setLeftDrawerAnimationType:style];
[[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:style];
}
学习的时间总是过得很快,虽然每一天的起床都很煎熬,但到教室后一天很快就过去了。时间越来越少,会的东西也越来越多,进入项目二的学习后,接触的第三方框架也越来越多,比如像项目二的大框架就是一个MMDrawerController,创建代码如下
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor clearColor];
//从故事板(storybord)中获取控制器对象
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
[[NSNotificationCenter defaultCenter]addObserver:selfselector:@selector(_setAnimation) name:kStyleNotification object:nil];
//设置左边的控制器
self.leftDrawerViewController = [storybord instantiateViewControllerWithIdentifier:@"LeftVC"];
//设置中间的控制器
self.centerViewController = [storybord instantiateViewControllerWithIdentifier:@"CenterVC"];
//设置右边的控制器
self.rightDrawerViewController = [storybord instantiateViewControllerWithIdentifier:@"RightVC"];
//设置阴影
[self setShowsShadow:YES];
//设置两边的宽度
[self setMaximumLeftDrawerWidth:160.0];
[self setMaximumRightDrawerWidth:60.0];
//设置手势的作用区域
[self setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[self setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
//配置动画的回调函数
[self setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
MMDrawerControllerDrawerVisualStateBlock block;
block = [[MMExampleDrawerVisualStateManagersharedManager]drawerVisualStateBlockForDrawerSide:drawerSide];
if (block) {
block(drawerController,drawerSide,percentVisible);
}
}];
//设置动画
[self _setAnimation];
}
//设置动画
- (void)_setAnimation
{
//从数据中拿到选中的样式
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSInteger style = [[defaults objectForKey:kAnimationStyle]integerValue];
//根据样式的枚举值设置动画
[[MMExampleDrawerVisualStateManager sharedManager] setLeftDrawerAnimationType:style];
[[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:style];
}
相关文章推荐
- C语言strcpy函数
- 两个链表的第一个公共结点
- Win7 Eclipse Hadoop2.4插件配置
- Win7 Eclipse Hadoop2.4插件配置
- HTTP页面请求的返回值
- 在JSP中如何使用JSTL(EL表达式)格式化日期
- Delphi关于TTask的外部中断&等待结束
- mtk智能机平台编译内核
- Linux守护进程log——syslog
- jps出现process information unavailable的问题
- 在Visual Studio 2013顯示SCSS詳細錯誤訊息
- web工程中友好的自定义错误返回页面
- [IOS 开发] sqlite 使用事务操作数据库
- CentOS 6.5下Redmine的安装配置
- jquery 获取 自定义属性(attr 和 prop)
- JUnit断言方法
- Windows系统Ionic安装教程/Ionic环境配置
- 网页常用动态效果--多表单验证
- Foundation框架2
- 但愿老死花酒间,不愿鞠躬车马前