【问题标题】:Dismiss a modal viewController with push/pop animation in iOS在 iOS 中使用推送/弹出动画关闭模态视图控制器
【发布时间】:2013-08-20 23:49:58
【问题描述】:

演示时:

CATransition *animation=[CATransition animation];
animation.delegate=self;
animation.duration=0.3;
animation.type=kCATransitionMoveIn;
animation.subtype=kCATransitionFromRight;

UIViewController13 *vc = [[UIViewController13 alloc] init];
[self presentViewController:vc animated:NO completion:nil];
[vc.view.layer addAnimation:animation forKey:@"animation"];

但我不知道如何自定义关闭动画

【问题讨论】:

  • 我认为你不能这样做我面临同样的问题,但我不能
  • 当我问同样的问题时,我最终使用了 UINavigationController 并且没有搞乱 iOS 默认行为。模态视图和被推送到导航堆栈的普通视图之间存在根本区别。改变它似乎很不合逻辑。
  • 淡入淡出效果很简单,但是推送应该是另一种方式@RanjuPatel
  • 谢谢! @SergiusGee

标签: ios objective-c uinavigationcontroller uiviewanimation


【解决方案1】:

试着去做:

CATransition *animation=[CATransition animation];
animation.delegate=self;
animation.duration=0.3;
animation.type=kCATransitionMoveIn;
animation.subtype=kCATransitionFromRight;

UIViewController13 *vc = [[UIViewController13 alloc] init];

[self presentViewController:vc animated:NO completion:nil];
[self.view insertSubview:vc.view atIndex:0];  //line we add
[self.view.layer addAnimation:animation forKey:@"animation"]; //we edit

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-06
    • 1970-01-01
    • 1970-01-01
    • 2012-08-17
    • 2014-09-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多