gpt4 book ai didi

iphone - 无法在 didFinishLaunchingWithOptions 中制作动画

转载 作者:行者123 更新时间:2023-11-29 04:29:59 25 4
gpt4 key购买 nike

我在 didFinishLaunchingWithOptions 中有这段代码:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

UIViewController *myViewController = [[UINavigationController alloc] initWithRootViewController:[[ViewController alloc] init]];

self.window.rootViewController = myViewController;

[self.window makeKeyAndVisible];

我想让一个 UIImageView 出现,播放动画,然后消失。我将此代码添加到现有代码中,但没有任何反应:

UIImageView *imgView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

NSArray *animationFrames = [[NSArray alloc]initWithObjects:blablahblah, nil];

imgView.animationImages = animationFrames;
imgView.animationDuration = 1.5;
imgView.animationRepeatCount = 1;

我在这里做错了什么?提前致谢!

最佳答案

将代码放入 ViewDidLoad 中。

.m

animation.animationImages = [NSArray arrayWithObjects:

[UIImageimageNamed:@"chicken1.tiff"],

[UIImageimageNamed:@"chicken2.tiff"],

[UIImageimageNamed:@"chicken3.tiff"],nil];

[animationsetAnimationRepeatCount:0];

animation.animationDuration = 1;

[动画开始动画];

.h

IBOutlet UIImageView *动画;

关于iphone - 无法在 didFinishLaunchingWithOptions 中制作动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11869032/

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