自定义Segue与UIViewAnimationOptionTransitionCurlDown

时间:2012-02-19 11:02:44

标签: objective-c animation curl segue

我想创建一个自定义segue来交换带有卷曲动画的ViewControllers,但我找不到方法, - (void)会为此执行什么?

我有这个

-(void)perform{
    UIViewController *dst = [self destinationViewController];
    UIViewController *src = [self sourceViewController];    
    [UIView beginAnimations:nil context:nil];
    //change to set the time
    [UIView setAnimationDuration:1];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:src.view    cache:YES];
    [UIView commitAnimations];
}

但我无法改变观点,无论如何,谢谢你的帮助!

1 个答案:

答案 0 :(得分:3)

没关系,我解决了,为了记录我唯一要做的就是添加一个导航控制器然后我可以使用自定义segues:

- (void) perform {
    UIViewController *src = (UIViewController *) self.sourceViewController;
    UIViewController *dst = (UIViewController *) self.destinationViewController;
    [UIView transitionWithView:src.navigationController.view duration:0.3
                       options:UIViewAnimationOptionTransitionFlipFromBottom
                    animations:^{
                        [src.navigationController pushViewController:dst animated:NO];
                    }
                    completion:NULL];
}