page 1
当我单击按钮时,我有按钮,我正在执行一些动画和导航到新页面说Page 2
。
当page 2
我点击我想回到我的previuos页面时Page 1
有取消按钮,但点击取消按钮我的应用程序崩溃。
这是我在Page 1:
页面名称 CRViewController上的示例代码
- (IBAction)ClickMe:(id)sender {
RegistraionViewController *secondController = [[RegistraionViewController alloc] init];
CATransition *transitionAnimation = [CATransition animation];
[transitionAnimation setDuration:1];
[transitionAnimation setType:@"push"];
[transitionAnimation setSubtype:kCATransitionFromBottom];
[transitionAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
[self.view.layer addAnimation:transitionAnimation forKey:kCATransitionFromBottom];
[self.view addSubview:secondController.view];
}
Page 2:
页面名称RegistraionViewController上的代码(点击时崩溃。)
- (IBAction)Click:(id)sender {
CRViewController *secondController = [[CRViewController alloc] init];
CATransition *transitionAnimation = [CATransition animation];
[transitionAnimation setDuration:1];
[transitionAnimation setType:@"push"];
[transitionAnimation setSubtype:kCATransitionFromTop];
[transitionAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
[self.view.layer addAnimation:transitionAnimation forKey:kCATransitionFromBottom];
[self.view addSubview:secondController.view];
}