【发布时间】:2015-10-13 06:53:59
【问题描述】:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.textColor=[UIColor blackColor];
cell.textLabel.font=[UIFont fontWithName:@"Helvetica Neue" size:14.0];
if (indexPath.section == 0) {
switch (indexPath.row) {
case 0:
cell.textLabel.text=@"Sub-Scheme 1";
break;
case 1:
cell.textLabel.text=@"Sub-Scheme 2";
break;
case 2:
cell.textLabel.text=@"Sub-Scheme 3";
break;
case 3:
cell.textLabel.text=@"Sub-Scheme 4";
break;
case 4:
cell.textLabel.text=@"Sub-Scheme 5";
break;
default:
break;
}
}else{
cell.textLabel.text=@" ";
}
return cell;
}
【问题讨论】:
-
当你说“cell.textlabel.text 在滚动表格视图时重复”是什么意思?你的意思是说,所有单元格的文本在特定部分都是相同的?
-
请看我在下面发布的答案,这并没有忽略单元格的出列。
标签: ios objective-c iphone xcode uitableview