iOS 转场动画UIViewControllerTransitioningDelegate代理
来源:互联网 发布:淘宝电脑认证入口 编辑:程序博客网 时间:2024/05/20 01:13
最近在看转场动画问题,心中有些疑惑就查了一些信息.
从VC1 present VC2
VC1 就充当presenting view controller
VC2就是presented view controller
UIViewControllerTransitioningDelegate 方法:
(nullable id )animationControllerForPresentedController:(UIViewController )presented presentingController:(UIViewController )presenting sourceController:(UIViewController *)source;
(nullable id )animationControllerForDismissedController:(UIViewController *)dismissed;
(nullable id )interactionControllerForPresentation:(id )animator;
(nullable id )interactionControllerForDismissal:(id )animator;
(nullable UIPresentationController )presentationControllerForPresentedViewController:(UIViewController )presented presentingViewController:(nullable UIViewController )presenting sourceViewController:(UIViewController )source NS_AVAILABLE_IOS(8_0);
控制器要遵循UIViewControllerTransitioningDelegate代理.看了些demo有些是在VC2中实现这四代理
突然有些疑惑.为什么非要在VC2中实现.API文档也没说在哪个VC中实现.
自己就试着在VC1中去实现,发现效果也是可以实现的.这是心中的疑惑就更大了.
想到present 有presenting 和presented.上面四个代理也类似ForPresentedController
自己就在想四个代理是不是在两个VC中分开实现.事实证明想法是对的.
在VC1 中用
(id)interactionControllerForDismissal:(id)animator;
(id)interactionControllerForPresentation:(id)animator;
在VC2中用
(id)animationControllerForPresentedController:(UIViewController )presented presentingController:(UIViewController )presenting sourceController:(UIViewController *)source;
(id)animationControllerForDismissedController:(UIViewController *)dismissed;
PS: 在VC1 和VC2 中遵循代理:
- (instancetype)init
{
self = [super init];
if (self) {
self.transitioningDelegate = self;
self.modalPresentationStyle = UIModalPresentationCustom;
}
return self;
}
总结:
通过自己的实验发现上面的三种方法都可以实现效果.VC1 present VC2 的过程中.是要实现UIViewControllerTransitioningDelegate代理的,不管是在VC1 和VC2 中,可能只是时间略有延迟的问题.
时间原因就写到这,有什么问题,或者更好理解请联系.
- iOS 转场动画UIViewControllerTransitioningDelegate代理
- iOS之转场动画/自定义转场动画
- UIView转场动画 IOS
- iOS 导航转场动画
- iOS自定义转场动画
- ios 转场动画
- iOS自定义转场动画
- ios-转场动画
- iOS 转场动画等
- IOS 自定义转场动画。
- iOS自定义转场动画
- iOS转场动画详解
- iOS - 转场动画
- iOS 转场动画笔记
- iOS 自定义转场动画
- iOS自定义转场动画
- IOS 转场动画(六)
- iOS - 自定义转场动画
- 网络安全监控 NSM 笔记
- window.onload和body的onload的区别
- 倒数求和
- C语言之动态数组
- MyBatis-入门、动态代理、配置
- iOS 转场动画UIViewControllerTransitioningDelegate代理
- 阶乘
- 数据结构——栈实现括号匹配
- JavaSE_split 调用特殊的分隔符
- oracle创建数据库
- 《Going Deeper With Convolution》全文译解
- Appium中的activity无法启动问题
- Date类型时间加一天
- 营销通外推软件