- (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所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)