gpt4 book ai didi

ios - 动画 24 张大图像 - 每张 728x936 大小

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

我现在通过设置 UIImageView 图层的内容让它们具有动画效果。我也试过设置 UIImageView 的图像属性:

self.curtainAnimationView.image = image;

我正在使用 NSTimer 调用设置图像的方法:

- (void) performCurtainAnimationWithFrame {    
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
CGImageRef ref = ((UIImage *)[animationImages objectAtIndex:currentFrame]).CGImage;
self.curtainAnimationView.layer.contents = (id)ref;
CGImageRelease(ref);
[pool drain];

currentFrame++;
}

定时器函数是:

NSTimer* timer = [NSTimer timerWithTimeInterval:0.1 target:self selector:@selector(performCurtainAnimationWithFrame) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

这是一个 iPad 项目,因此图像尺寸较大。

我也使用了 UIImageView 的 animationImages 属性,但我需要知道动画何时结束,而 UIImageView 中没有委托(delegate)方法。

如果有人有任何意见,我们将不胜感激。

最佳答案

如何从数组制作动画

yourImageView.animationImages=arrayOfImages;
yourImageView.animationDuration=5.0;
yourImageView.animationRepeatCount=1;

[yourImageView startAnimating];

那么你就知道持续时间了

[self performSelector:@selector(yourMethod) withObject:nil afterDelay:5.0];

关于ios - 动画 24 张大图像 - 每张 728x936 大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9605679/

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