iOS--ViewController转场
来源:互联网 发布:中国医科大学网络 编辑:程序博客网 时间:2024/06/06 02:47
前言
看到seedante的转场文章iOS 视图控制器转场详解,有兴趣就跟着学习咯.
转场协议
// UIViewControllerTransitioning.h// 1. 转场代理(required),提供动画控制器与交互控制器@protocol UIViewControllerTransitioningDelegate <NSObject>// 2. 转场上下文(required),提供转场过程中视图控制器等相关的属性@protocol UIViewControllerContextTransitioning <NSObject>// 3. 动画控制器(required),执行动画@protocol UIViewControllerAnimatedTransitioning <NSObject>// 4. 交互(optional),控制交互@protocol UIViewControllerInteractiveTransitioning <NSObject> // UIViewControllerTransitionCoordinator.h// 5. 转场协调(optional),协调转场动画与其它动画,可让两者并行执行@protocol UIViewControllerTransitionCoordinator <UIViewControllerTransitionCoordinatorContext>
转场代理
转场代理里动画控制器与交互控制器可选实现。 没有实现或者返回nil则使用默认的转场效果。
@protocol UIViewControllerTransitioningDelegate <NSObject>@optional- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source;- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed;- (nullable id <UIViewControllerInteractiveTransitioning>)interactionControllerForPresentation:(id <UIViewControllerAnimatedTransitioning>)animator;- (nullable id <UIViewControllerInteractiveTransitioning>)interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)animator;- (nullable UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(UIViewController *)presenting sourceViewController:(UIViewController *)source NS_AVAILABLE_IOS(8_0);@end
转场上下文
该协议中蛮多方法的。
@protocol UIViewControllerContextTransitioning <NSObject>- (nullable UIView *)containerView;- (BOOL)isAnimated;- (BOOL)isInteractive; // This indicates whether the transition is currently interactive.- (BOOL)transitionWasCancelled;- (UIModalPresentationStyle)presentationStyle;- (void)updateInteractiveTransition:(CGFloat)percentComplete;- (void)finishInteractiveTransition;- (void)cancelInteractiveTransition;- (void)completeTransition:(BOOL)didComplete;- (nullable __kindof UIViewController *)viewControllerForKey:(NSString *)key;- (nullable __kindof UIView *)viewForKey:(NSString *)key NS_AVAILABLE_IOS(8_0);- (CGAffineTransform)targetTransform NS_AVAILABLE_IOS(8_0);- (CGRect)initialFrameForViewController:(UIViewController *)vc;- (CGRect)finalFrameForViewController:(UIViewController *)vc;@end
动画控制器
@protocol UIViewControllerAnimatedTransitioning <NSObject>- (NSTimeInterval)transitionDuration:(nullable id <UIViewControllerContextTransitioning>)transitionContext;- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext;@optional// This is a convenience and if implemented will be invoked by the system when the transition context's completeTransition: method is invoked.- (void)animationEnded:(BOOL) transitionCompleted;@end
交互控制器
@protocol UIViewControllerInteractiveTransitioning <NSObject>- (void)startInteractiveTransition:(id <UIViewControllerContextTransitioning>)transitionContext;@optional- (CGFloat)completionSpeed;- (UIViewAnimationCurve)completionCurve;@end
参考资料
iOS 视图控制器转场详解
自定义 ViewController 容器转场
0 0
- iOS--ViewController转场
- 自定义 ViewController 容器转场
- ViewController的自定义转场动画
- ViewController转场动画的切换
- 自定义ViewController的转场动画
- ViewController自定义转场-基础
- viewController自定义转场动画的实现
- Swift-->ViewController跳转,转场以及自定义动画
- IOS ViewController
- iOS之转场动画/自定义转场动画
- UIView转场动画 IOS
- iOS 导航转场动画
- iOS自定义转场动画
- ios 转场动画
- iOS —— 转场
- iOS自定义转场动画
- ios-转场动画
- iOS 转场动画等
- Android6.0.1音乐apk获得audioFocus的流程
- 单点登陆_配置客户端与服务器端
- thinkphp中memcache缓存
- windows 8无法通过samba访问树莓派
- HDU 3826 Squarefree number:题目解答源码
- iOS--ViewController转场
- xml读取到ValueMap问题
- 121. Best Time to Buy and Sell Stock(贪心)
- mysql数据库,存储过程中如何判断游标Cursor中结果集是否为空
- Eclipse快捷键总结
- Android 的几个单位dp 、sp、px的转换
- CTR预估模型浅谈
- Session的生命周期
- ARM64的启动过程之(六):异常向量表的设定