如何启动.View在tableView中的每个单元格?

时间:2011-08-15 07:16:48

标签: iphone objective-c ios tableview gif

当我在tableview中选择一个单元格时,会停止.gif的动画。如何解决,谁能给我一些建议?

3 个答案:

答案 0 :(得分:2)

iOS不支持gif动画。你必须这样做 -

-(void)startImageViewAnimation
{
NSArray *animationImages = [NSarray arrayWithObjects:[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],nil];

UIImageView *imageView = [UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)];
imageView.animationImages = animationImages ;
imageView.animationRepeatCount = 2;
imageView.animationDuration= 4.0;
[imageView startAnimating];

[NSTimer scheduledTimerWithTimeInterval:4.0 target:self
selector:@Selector(animationDone:)
userInfo:nil repeats:NO];
} 

-(void)animationDone:(NSTimer*)inTimer
{
[inTimer invalidate];
inTimer = nil;
NSLog(@"animationDone ");
}

答案 1 :(得分:0)

据我所知iPhone SDK没有.gifs你必须自己通过UIView做动画

答案 2 :(得分:0)

UIImage没有动画GIF的内置支持,但使用Image I / O框架加载它们非常容易。

Image I/O Programming Guide
Image I/O Reference Collection

我有示例代码,可以在github上的动画GIF中创建动画UIImage

https://github.com/mayoff/uiimage-from-animated-gif