PresentModel UIViewController 的动画方式
来源:互联网 发布:c#连接mysql命令 编辑:程序博客网 时间:2024/04/26 07:33
添加分类:
#import <UIKit/UIKit.h>@interface UIViewController (Transitions)- (void) presentModalViewController:(UIViewController *)modalViewController withPushDirection: (NSString *) direction;- (void) dismissModalViewControllerWithPushDirection:(NSString *) direction;@end
实现:
#import "UIViewController+Transitions.h"@implementation UIViewController (Transitions)- (void) presentModalViewController:(UIViewController *)modalViewController withPushDirection: (NSString *) direction { [CATransaction begin]; CATransition *transition = [CATransition animation]; transition.type = kCATransitionPush; transition.subtype = direction; transition.duration = 0.25f; transition.fillMode = kCAFillModeForwards; transition.removedOnCompletion = YES; [[UIApplication sharedApplication].keyWindow.layer addAnimation:transition forKey:@"transition"]; [[UIApplication sharedApplication] beginIgnoringInteractionEvents]; [CATransaction setCompletionBlock: ^ { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(transition.duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^ { [[UIApplication sharedApplication] endIgnoringInteractionEvents]; }); }]; [self presentModalViewController:modalViewController animated:NO]; [CATransaction commit]; }- (void) dismissModalViewControllerWithPushDirection:(NSString *) direction { [CATransaction begin]; CATransition *transition = [CATransition animation]; transition.type = kCATransitionPush; transition.subtype = direction; transition.duration = 0.25f; transition.fillMode = kCAFillModeForwards; transition.removedOnCompletion = YES; [[UIApplication sharedApplication].keyWindow.layer addAnimation:transition forKey:@"transition"]; [[UIApplication sharedApplication] beginIgnoringInteractionEvents]; [CATransaction setCompletionBlock: ^ { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(transition.duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^ { [[UIApplication sharedApplication] endIgnoringInteractionEvents]; }); }]; [self dismissModalViewControllerAnimated:NO]; [CATransaction commit]; }@end
- PresentModel UIViewController 的动画方式
- presentmodel 的navigationController设置
- UIViewController的切换方式
- UIViewController 的表现方式
- UIViewController的表现方式
- UIViewController 之间的动画切换
- 设置UIViewController模态进入的动画
- CATransition 两个UIViewController 之间的跳转动画
- UIViewController的出现和消失动画
- UIViewController页面跳转的两种方式
- UIViewController 间的传值方式
- UIViewController转场动画
- iOS开发-UIViewController之间的动画切换
- UIViewController的一些属性(CATrasition转场动画)
- 【iOS开发】UIViewController之间的切换动画效果
- UIViewController的跳转方式
- iOS UIViewController之间的传值方式之一:委托代理
- UIViewController之间的传值方式二 通知
- 抽象方法和虚方法的区别
- Dynamics CRM小窍门——数据读写锁
- 物理dg failover 后 system01.dbf 不一致
- 黑马程序员--Java基础之面向对象(2)
- C# 多态
- PresentModel UIViewController 的动画方式
- Python多线程学习
- Zigbee网络架构
- 如何查看自己机子上开了哪些端口
- oracle
- Linux查看系统配置常用命令
- C#之克隆
- 日期的一些常见用法
- 看法