EGOImageView* imageView;
imageView = [[EGOImageView alloc] initWithPlaceholderImage:[UIImage imageNamed:@"placeholder.png"]];//最初图片没加载完成的时候的占用(默认)图片
imageView.frame = CGRectMake(4.0f, 4.0f, 36.0f, 36.0f);
[self.contentView addSubview:imageView];
imageView.frame = CGRectMake(4.0f, 4.0f, 36.0f, 36.0f);
[self.contentView addSubview:imageView];
//cell的赋值
- (void)setFlickrPhoto:(NSString*)flickrPhoto {
imageView.imageURL = [NSURL URLWithString:flickrPhoto];//
}
//当某个cell由于滚动,从父视图跑出来了(将要移出父视图)就取消图片加载
imageView.imageURL = [NSURL URLWithString:flickrPhoto];//
}
//当某个cell由于滚动,从父视图跑出来了(将要移出父视图)就取消图片加载
- (void)willMoveToSuperview:(UIView *)newSuperview {
[super willMoveToSuperview:newSuperview];
if(!newSuperview) {
[imageView cancelImageLoad];
}
}
[super willMoveToSuperview:newSuperview];
if(!newSuperview) {
[imageView cancelImageLoad];
}
}
//清除缓存
- (IBAction)clearCache {
[[EGOCache currentCache] clearCache];
[self.tableView reloadData];
}
//跳到tableview的最后一行
- (IBAction)jumpToBottom {
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:flickrPhotos.count-1 inSection:0]
atScrollPosition:UITableViewScrollPositionBottom
animated:NO];
}
[[EGOCache currentCache] clearCache];
[self.tableView reloadData];
}
//跳到tableview的最后一行
- (IBAction)jumpToBottom {
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:flickrPhotos.count-1 inSection:0]
atScrollPosition:UITableViewScrollPositionBottom
animated:NO];
}