Custom Segue with UIViewAnimationOptionTransitionCurlDown

时光怂恿深爱的人放手 提交于 2019-12-05 01:13:09

问题


I'd like create a custom segue to swap ViewControllers with a curl up animation but I can't find a way, What would be the -(void)perform for this?

I've got this

-(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];
}

But I don't get to change the view, anyway thanks for your help!


回答1:


Nevermind, I solved it, for the record the only thing I had to do was add a Navigation Controller and then I could use custom segues like:

- (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];
}


来源:https://stackoverflow.com/questions/9348605/custom-segue-with-uiviewanimationoptiontransitioncurldown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!