我正在使用自定义cell.here我加载两个图像和四个标签。 TableView
滚动不顺畅。我的代码也是。
static NSString *simpleTableIdentifier = @"SimpleTableCell";
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCellSixPlus" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.cellButtonOutlet.tag = indexPath.row;
[cell.cellButtonOutlet addTarget:self action:@selector(yourButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
NSManagedObjectModel *device = [self.devices objectAtIndex:indexPath.row];
long int index1 = [languageCode indexOfObject: [NSString stringWithFormat:@"%@",[device valueForKey:@"sourceLang"]]];
long int index2 = [languageCode indexOfObject: [NSString stringWithFormat:@"%@",[device valueForKey:@"destinationLang"]]];
cell.nameLabel1.text = [languageName objectAtIndex:index1];
cell.nameLabel2.text = [languageName objectAtIndex:index2];
cell.nameLabel3.text = [NSString stringWithFormat:@"%@",[device valueForKey:@"sourceText"]];
cell.nameLabel4.text = [NSString stringWithFormat:@"%@",[device valueForKey:@"transilateText"]];
cell.sourceFlagImageview.image = [UIImage imageNamed:[languageName objectAtIndex:index1]];
cell.translateFlagImageview.image = [UIImage imageNamed:[languageName objectAtIndex:index2]];
return cell;
通过增加细胞高度解决问题
答案 0 :(得分:1)
在以下代码行中发表评论,然后重试:
long int index1 = [languageCode indexOfObject: [NSString stringWithFormat:@"%@",[device valueForKey:@"sourceLang"]]];
long int index2 = [languageCode indexOfObject: [NSString stringWithFormat:@"%@",[device valueForKey:@"destinationLang"]]];
cell.sourceFlagImageview.image = [UIImage imageNamed:[languageName objectAtIndex:index1]];
cell.translateFlagImageview.image = [UIImage imageNamed:[languageName objectAtIndex:index2]];
如果它能正常工作,那么你需要在后台队列中分配图像