UITableView 和 ASIHTTPRequest
如何将下载的图像放入单元格中?
我不知道如何在加载到 cell.imageView.image
时将响应数据输出。
这是代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
....
....
NSURL *photoURL = [NSURL URLWithString:user.photo];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:photoURL];
[request setDownloadCache:[ASIDownloadCache sharedCache]];
[request setDelegate:self];
[request startAsynchronous];
cell.textLabel.text = [NSString stringWithFormat:@"%@ %@",user.first_name,user.last_name];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//image loaded
- (void)requestFinished:(ASIHTTPRequest *)request
{
NSData *responseData = [request responseData];
}
How do I put a downloaded image into a cell?
I don't know how to put response data out when it loaded into cell.imageView.image
.
Here is the code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
....
....
NSURL *photoURL = [NSURL URLWithString:user.photo];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:photoURL];
[request setDownloadCache:[ASIDownloadCache sharedCache]];
[request setDelegate:self];
[request startAsynchronous];
cell.textLabel.text = [NSString stringWithFormat:@"%@ %@",user.first_name,user.last_name];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//image loaded
- (void)requestFinished:(ASIHTTPRequest *)request
{
NSData *responseData = [request responseData];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里是一个示例代码有指导线和 简要说明。
Here is a sample code to have a guide line and a brief description.