使用 UIViewAnimationOptionTransitionCurlDown 自定义 Segue

发布于 2025-01-07 17:52:18 字数 581 浏览 0 评论 0原文

我想创建一个自定义 Segue 来用卷曲动画交换 ViewController,但我找不到方法,-(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];
}

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

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

把时间冻结 2025-01-14 17:52:18

没关系,我解决了这个问题,根据记录,我唯一要做的就是添加一个导航控制器,然后我可以使用自定义转场,例如:

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

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];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文