如何让tablerecyclerview自动滚动在数据很少的情况下任然可以滚动

实现TableView滚动停止时才加载数据信息,滚动期间用默认图片显示。(转)
// 滚动停止的时候再去获取image的信息来显示在UITableViewCell上- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
if(!decelerate){
loadImagesForOnscreenRows];
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
loadImagesForOnscreenRows];
// 装载图片举例- (void)loadImagesForOnscreenRows
if([self.entries count] & 0)
NSArray *visiblePaths = [self.tableView indexPathsForVisibleRows];
for(NSIndexPath *indexPath in visiblePaths)
AppRecord *appRecord = [self.entries objectAtIndex:indexPath.row];
if(!appRecord.appIcon)
startIconDownload:appRecord
forIndexPath:indexPath];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//初始化UITableView的相关信息
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleN
// 当UITableViewCell还没有图像信息的时候
if(!appRecord.appIcon)
if(self.tableView.dragging == NO && self.tableView.decelerating == NO)
//table停止不再滚动的时候下载图片(先用默认图片来代替Cell的image)
startIconDownload:appRecord
forIndexPath:indexPath];
cell.imageView.image = [UIImage imageNamed:@"Placeholder.png"];
//当appRecord已经有图片信息的时候直接显示
cell.imageView.image = appRecord.appI
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

我要回帖

更多关于 scrollview自动滚动 的文章

 

随机推荐