Chr*_*fer 5 cocoa-touch ios ios5
我在Storyboard中设置了两个视图控制器,每个控制器都有一个动作按钮.我设置了两个segues:
一切正常,但我希望它可以单向翻转,现在它可以为两个视图控制器翻转相同的方向.
制作翻转翻转效果的最简单方法是什么?
我遇到了同样的问题,希望找到解决方案.
我用一个自定义的segue来翻转回来的路.这是我的代码FlipLeftSegue
@implementation FlipLeftSegue
- (void)perform
{
UIViewController *src = (UIViewController *) self.sourceViewController;
UIViewController *dst = (UIViewController *) self.destinationViewController;
[UIView beginAnimations:@"LeftFlip" context:nil];
[UIView setAnimationDuration:0.8];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:src.view.superview cache:YES];
[UIView commitAnimations];
[src presentViewController:dst animated:NO completion:nil];
}
@end
Run Code Online (Sandbox Code Playgroud)
我在这个解决方案中viewDidAppear遇到的唯一问题是,当动画开始时,该方法立即被调用.而正常的segue则在动画后调用.
我建议不要创建一个ViewController的新表示,而是建议在第二个ViewController上访问该属性以呈现ViewController,然后在其上调用-dismissViewControllerAnimated:completion :. 像这样:
-(IBAction)someResponderToYourCancelButtonOrWhatever:(id)sender {
// Do some stuff
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6002 次 |
| 最近记录: |