我正在使用cell.image = an animated gif file
(单元格为UITableViewCell
)。但是,它不生动。有什么方法可以解决它吗?动画GIF在iPhone上不起作用
7
A
回答
-2
你唯一的选择是编码自己的机制,在视图中呈现GIF或等待苹果来修复它。
2
在iPhone OS 3.0中,不再支持cell.image。相反,单元格有一个imageView属性,它给了你更多的灵活性。您可以拆分GIF动画成单独的图像,然后做到这一点:
anImageView *UIImageView = [[UIImageView alloc] init];
anImageView.animationImages = imagesArray; //this is an array of UIImages you have to create
15
UIImageView
提供了必要的API来制作自己的动画这样的:
UIImage *frame1 = [UIImage imageNamed:@"frame1.png"];
UIImage *frame2 = [UIImage imageNamed:@"frame2.png"];
UIImage *frame3 = [UIImage imageNamed:@"frame3.png"];
UIImage *frame4 = [UIImage imageNamed:@"frame4.png"];
UIImageView.animationImages = [[NSArray alloc] initWithObjects:frame1, frame2, frame3, frame4, nil];
UIImageView.animationDuration = 1.0 //defaults is number of animation images * 1/30th of a second
UIImageView.animationRepeatCount = 5; //default is 0, which repeats indefinitely
[UIImageView startAnimating];
//[uiImageView stopAnimating];
1
只有UIWebView的支持显示动画GIF文件。
1
能否请你看下面的代码,我希望这将有助于你...
1 cellforatindexpath删除动画代码
2.动画时,电池显示它
3.停止动画,而隐藏在细胞
4.将改进的应用程序
5.性能保存更多的内存
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
NSArray *myImageArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"image1.png"],
[UIImage imageNamed:@"image2.png"],
[UIImage imageNamed:@"image3.png"],
[UIImage imageNamed:@"image4.png"],
[UIImage imageNamed:@"image5.png"],nil];
[cell.imageView setAnimationImages:myImageArray];
cell.imageView.animationDuration = 4.0;
cell.imageView.animationRepeatCount = 1;
[cell.imageView startAnimating];
}
-(void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
[cell.imageView stopAnimating];
[cell.layer removeAllAnimations];
}
相关问题
- 1. PhoneGap启动画面动画gif不起作用
- 2. 在iPhone上滚动iframe不起作用
- 3. 当应用程序运行时,动画gif不起作用
- 4. 动画gif不是动画
- 5. 动画GIF图像作为iPhone的启动画面
- 6. Java:在其他动画gif上叠加/叠加动画gif
- 7. 我可以在iPhone上使用UIImageView叠加动画GIF吗?
- 8. PHP imagecreatefrom gif()不适用于动画gif
- 9. 动画GIF不在WPF中动画
- 10. 在另一个动画gif上绘制一个动画gif而不闪烁?
- 11. Mixamo上的动画不起作用
- 12. 核心动画 - 动画不起作用
- 13. Imagick制作动画GIF动画?
- 14. 动画在android活动不起作用
- 15. 使用MKOverlayRenderer在MKMapView覆盖图中不起作用的动画gif
- 16. 动画在iPhone上工作,但不在iPad上工作
- 17. UIView动画不起作用
- 18. JQuery动画不起作用
- 19. CSS3动画不起作用
- 20. 动画CCSprite不起作用?
- 21. 动画不起作用
- 22. popViewControllerAnimated动画不起作用
- 23. 动画不起作用
- 24. JavaScript动画不起作用
- 25. PopupWindow动画不起作用
- 26. TweenJS动画不起作用
- 27. Leaflet.markercluster:动画不起作用
- 28. webkit动画不起作用
- 29. 动画CSS3 - 不起作用
- 30. 动画不起作用?
这是一个有用的答案,但更精确的代码应该说:' * UIImageView的animatedImageView; animatedImageView.animationImages = ...; animatedImageView.animationDuration = ...; ...;` – Neeku 2014-02-21 11:32:49