0
我正在使用自定義單元格。此處我加載兩個圖像和四個標籤。 TableView
滾動不順暢。這裏是我的代碼。UITableView滾動與ios中的自定義表格單元格不平滑
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;
問題,通過增加細胞高度代碼
嘗試在背景隊列中設置圖像,而不是在主線程中設置圖像 –