如何在iOS中滚动时禁用重新加载tableview

如何在iOS中滚动时禁用重新加载tableview,第1张

概述我想在滚动禁用重新加载表视图.现在,我的应用程序在用户滚动uitableview时,已经调用了cellForRowAtIndexPath.如何在srcolling时禁用它?请给我一些建议.提前致谢. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexP 我想在滚动时禁用重新加载表视图.现在,我的应用程序在用户滚动uitablevIEw时,已经调用了cellForRowAtIndexPath.如何在srcolling时禁用它?请给我一些建议.提前致谢.

- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath{    Nsstring *CellIDentifIEr = [Nsstring stringWithFormat:@"%d,%d",indexPath.section,indexPath.row];    UItableVIEwCell *cell = [_tableVIEw dequeueReusableCellWithIDentifIEr:CellIDentifIEr];    UILabel *filenameLabel;    UILabel *UploadTimeLabel;    if (cell == nil)    {        cell = [[[UItableVIEwCell alloc] initWithStyle:UItableVIEwCellStyleDefault reuseIDentifIEr:CellIDentifIEr] autorelease];        CfilenameLabel = [[UILabel alloc] initWithFrame:CGRectMake(40,130,30)];            UploadTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(40,20,25)];        filenameLabel.tag = 1000;        filenameLabel.backgroundcolor = [UIcolor clearcolor];        filenameLabel.Font = [UIFont FontWithname:@"Helvetica" size:14];        filenameLabel.Font = [UIFont boldSystemFontOfSize:14];        filenameLabel.textcolor = [UIcolor blackcolor];        //  filenameLabel.text =[temp objectAtIndex:indexPath.row];        [cell.contentVIEw addSubvIEw: filenameLabel];        [filenameLabel release];        UploadTimeLabel.tag = 2000;        UploadTimeLabel.backgroundcolor = [UIcolor clearcolor];        UploadTimeLabel.Font = [UIFont FontWithname:@"Helvetica" size:12];        UploadTimeLabel.textcolor = [UIcolor graycolor];        // UploadTimeLabel.text = [UploadTimeArray objectAtIndex:indexPath.row];        [cell.contentVIEw addSubvIEw: UploadTimeLabel];        [UploadTimeLabel release];    }    if( [OriginalArray count] > 0)    {        UILabel *filenameLbl = (UILabel*)[cell.contentVIEw vIEwWithTag:1000];        //filenameLbl.text =[temp objectAtIndex:indexPath.row];        filenameLbl.text =[[OriginalArray valueForKey:@"filename"] objectAtIndex:indexPath.row];        UILabel *uploadlbl = (UILabel*)[cell.contentVIEw vIEwWithTag:2000];        uploadlbl.text =[[OriginalArray valueForKey:@"UPLOADTIME"] objectAtIndex:indexPath.row];    }    _tableVIEw.contentInset = UIEdgeInsetsMake(0,0);    return cell;}
解决方法 滚动tablevIEw时,无法阻止cellForRowAtIndexPath:调用.如果每次都不需要发生某些事情,您可以在条件允许的情况下将其保留.

if (cell == nil)    {        //Functionality goes here when it not needed to happen every time.    }
总结

以上是内存溢出为你收集整理的如何在iOS中滚动时禁用重新加载tableview全部内容,希望文章能够帮你解决如何在iOS中滚动时禁用重新加载tableview所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1055381.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存