图像在Cell之上 [英] Image on top of Cell

查看:74
本文介绍了图像在Cell之上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将图片放在 TableViewCell 的顶部,而不是将其放在左侧吗?我用这个把它放在单元格中:

Can i put an image in the top of an TableViewCell instead of putting it on the left side ? I used this to put it in the cell:

代码:

cell.imageView.image = [UIImage imagenNamed:@"river.png"];


推荐答案

对于异步图像下载和在桌面上显示,请使用:
转到 https://github.com/enormego/EGOImageLoading
并下载课程。
然后在你的.h文件中:

For asynchronous image downloading and showing on table use this: go to https://github.com/enormego/EGOImageLoading and download the classes. then in your .h file:

@class EGOImageView;

 EGOImageView *imageIconView;    // object for caching the images

和.m文件

#import "EGOImageView.h"
#import "EGOCache.h"

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
 UITableViewCell * cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];

imageIconView=[[EGOImageView alloc] initWithPlaceholderImage:[UIImage imageNamed:@"icon72x72.png"]];
[self setFlickrPhoto:[NSString stringWithFormat:@"yourimageurl"];
imageIconView.frame=CGRectMake(0, 0, 120, 100);
[cell addSubview:imageIconView];
return cell;
}

- (void)setFlickrPhoto:(NSString*)flickrPhoto
{

imageIconView.imageURL = [NSURL URLWithString:flickrPhoto];

}

这篇关于图像在Cell之上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆