0
以下代碼正常工作,應用不同的單元格屬性,但它將相同的單元格文本應用於所有部分。我怎樣才能應用選擇案例也取決於部分?謝謝。根據
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
switch (indexPath.row) {
case 0:
cell.textLabel.text = @"English";
break;
case 1:
cell.textLabel.text = @"Chinese";
break;
case 2:
cell.textLabel.text = @"Japanese";
break;
default:
break;
}
return cell;
}
不錯switch語句 – binnyb