如何在UITableView单元中加载图像,并在加载图像时使用淡入效果?在UITableView单元内,我怎样才能淡入淡入的图像?
回答
您正在尝试异步图像。有一个在提供一个伟大的文章:http://www.markj.net/iphone-asynchronous-table-image/
内connectionDidFInishLoading只是把在此之后
UIImageView* imageView = [[[UIImageView alloc] initWithImage:[UIImage imageWithData:data]] autorelease];
//Paste below code here
后褪色它:
//Paste following here
imageView.alpha = 0.0f;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5f];
imageView.alpha = 1.0f;
[UIView commitAnimations];
SDImageWeb是一个相当不错的库,它做什么你需要。它甚至具有图像缓存,所以一旦下载图像,下次从本地闪存中选取它们。
这是什么不能做的是fadeIn
效果。但这很容易添加,动画为UIView
。
所以异步下载图像, [imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]];
多数民众赞成..
要淡入动画放。
- (void)fadeInLayer:(CALayer *)l
{
CABasicAnimation *fadeInAnimate = [CABasicAnimation animationWithKeyPath:@"opacity"];
fadeInAnimate.duration = 0.5;
fadeInAnimate.repeatCount = 1;
fadeInAnimate.autoreverses = NO;
fadeInAnimate.fromValue = [NSNumber numberWithFloat:0.0];
fadeInAnimate.toValue = [NSNumber numberWithFloat:1.0];
fadeInAnimate.removedOnCompletion = YES;
[l addAnimation:fadeInAnimate forKey:@"animateOpacity"];
return;
}
要调用这个 - [self fadeInLayer: imageView.layer];
这应该做的伎俩。这动画,您的图像在0.5秒内从alpha 0到1!在动画中给予美妙的淡入淡出。
谢谢老兄。你能说我如何以编程方式添加fadeIn效果吗?当用户滚动并查看其他UIImageViews时,我会使用淡入效果来显示图像。 –
查看我的更新代码fadein animaiton ... –
- 1. 我们怎样才能给一个简单的滑块淡入淡出效果?
- 2. 我怎样才能让我的整个网站模糊,淡入淡出?
- 3. 淡入淡出背景图像淡入淡出div内容
- 4. 淡出/淡入图像在元素
- 5. 我怎样才能淡入淡出出现(使用.bind命令的列表?
- 6. 我怎样才能使这个淡入淡出成为幻灯片?
- 7. 简单的jQuery淡入淡出图像
- 8. 淡入淡出的图像
- 9. 淡入淡出图像进入UITableView编辑模式?
- 10. Javascript淡入淡出图像
- 11. 图像淡入淡出
- 12. android图像淡入淡出
- 13. Javascript - 淡入淡出图像?
- 14. 淡入淡出图像?
- 15. jquery淡入/淡出图像
- 16. Javascript图像淡入淡出?
- 17. jquery淡入淡出div中的背景图像 - 淡入淡出
- 18. 淡入图像,淡出出图像
- 19. 为什么我的图像不能淡入淡出?
- 20. 在背景图像中淡入淡出
- 21. 图像在画面上淡入淡出
- 22. 我怎么能在淡入/淡出数组中添加延迟
- 23. 淡入和图像
- 24. 使图像淡入
- 25. Android淡入图像
- 26. CSS淡入图像
- 27. UITableView淡入背景
- 28. 淡入淡出的图像javascript
- 29. 淡入淡出中的背景图像
- 30. 具有淡入淡出图像的CSS
谢谢,但我需要淡入效果。 –
评论已经更新。 –
谢谢哥们:) – Abo3atef