我有一个单元格和一个NSIntger
计算字符串中的行数。例子:
case 1:
NSString *string = @"abcde\nfghijk\nlmnopq\nrstu";
NSInteger length = [[string componentsSeparatedByCharactersInSet:
[NSCharacterSet newlineCharacterSet]] count];
cell.detailTextLabel.text = [NSString stringWithFormat:string];
cell.detailTextLabel.numberOfLines = length;
break;
这段代码在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
.
如何按NSIntger
长度设置单元格宽度?