【发布时间】:2012-03-07 16:45:50
【问题描述】:
我现在通过设置 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 中没有委托方法的动画何时结束。
如果有人有任何意见,将不胜感激。
【问题讨论】:
标签: ios ipad animation ios5 timer