我正在尝试在我的 viewControllers 之间创建自定义转换。我正在关注本教程,但单击/点击按钮后没有任何反应!
这是 CustomSegue.m 的代码
#import "CustomSegue.h"
#import "QuartzCore/QuartzCore.h"
@implementation CustomSegue
-(void)perform {
NSLog(@"ActionTest");
UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
UIViewController *destinationController = (UIViewController*)[self destinationViewController];
CATransition* transition = [CATransition animation];
transition.duration = .25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
transition.subtype = kCATransitionFromLeft; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
[sourceViewController.navigationController.view.layer addAnimation:transition forKey:kCATransition];
[sourceViewController.navigationController pushViewController:destinationController animated:NO];
}
@end
日志被记录,但没有执行转换,视图控制器也没有改变。我还将 segue 样式更改为“custom”,将 class 更改为“ZHCustomSegue”
我错过了什么吗?
谢谢