を破壊しない、それがこのUILabelは私のラベルはラインを破っていないライン
テキスト...
のように表示していると私はこの
のようなものを期待していますテキスト
&
テキスト2
は、ここでは、21個のピクセルの固定フレームの高さとoppLabelを設定し、セルへのサブビューとしてこれを追加している私のコード
UILabel *oppLabel = [[UILabel alloc] initWithFrame:CGRectMake(131, 10, 130, 21)];
oppLabel.numberOfLines = 0;
string = [[Array2 objectAtIndex:indexPath.row] objectForKey:@"O"];
NSString *string2 = [[NSString alloc]init];
string2 = [[Array2 objectAtIndex:indexPath.row] objectForKey:@"P"];
string = [string stringByAppendingString:@"\n VS\n"];
NSString *str = [NSString stringWithFormat: @"%@ %@",string,string2];
NSLog(str);
oppLabel.tag =1;
oppLabel.text = str;
cell.textLabel.numberOfLines=0;
[cell.textLabel setLineBreakMode:NSLineBreakByWordWrapping];
[cell.contentView addSubview:oppLabel];
return cell;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 100;
}
行oppLabel.numberOfLines = any value> 1の数を増やしてみるか、テキストごとに行数を動的に設定できます。 –