gpt4 book ai didi

iphone - 从一个 View Controller 移动到另一个 View Controller 时,基于 View 的应用程序从左到右过渡

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:50:50 25 4
gpt4 key购买 nike

MyView *view=[[[MyView alloc] init] autorelease];
[view setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:view animated:YES];

我在从一个 View Controller 移动到另一个 View Controller 时使用了翻转过渡。但我的要求是从左到右的过渡。请帮助我解决这个问题,在此先感谢。这是我的代码:

最佳答案

需要添加QuartzCore Framework,然后import #import <QuartzCore/QuartzCore.h>

MyView *next = [[MyView alloc] init];
CATransition *animation = [CATransition animation];
[self presentModalViewController:next animated:NO];
[animation setDuration:0.40];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
//[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
[[next.view layer] addAnimation:animation forKey:@"SwitchToView1"];
[next release];

关于iphone - 从一个 View Controller 移动到另一个 View Controller 时,基于 View 的应用程序从左到右过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10845785/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com