- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MCell" forIndexPath:indexPath];
switch (indexPath.row) {
case 0:
cell.textLabel.text = @"My Policies";
cell.textLabel.textColor = [UIColor redColor];
***cell.textLabel.numberOfLines = 0;***
break;
case 1:
cell.textLabel.text = @"Payment Info";
cell.textLabel.textColor = [UIColor redColor];
break;
case 2:
cell.textLabel.text = @"Policy Notes";
cell.textLabel.textColor = [UIColor redColor];
break;
case 3:
cell.textLabel.text = @"Events";
cell.textLabel.textColor = [UIColor redColor];
break;
default:
cell.textLabel.text = @"Docs";
cell.textLabel.textColor = [UIColor redColor];
break;
}
return cell;
}
不,没有必要,您可以通过将numberOfLines
从 textLabel
设置为 0 来轻松换行,它会自动自动换行内容。
cell.textLabel.numberOfLines = 0;