스토리 보드가없는 이전 Objective-C 프로젝트로 작업하고 있습니다. 3 개의 레이블이 포함 된 UITableViewCell
으로 결과를 표시하려면 UITableView
이 필요합니다. 작업은 여기에 UITableviewCell
목표 C 코드의 자동 행 높이 조절
에 수직으로 3 개 레이블을 정렬하는 것입니다 내 라벨 개시 :
serviceTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, 200, LONG_MAX)];
[serviceTitleLabel setFont:[UIFont SingPostRegularFontOfSize:16.0f fontKey:kSingPostFontOpenSans]];
[serviceTitleLabel setNumberOfLines:0];
[serviceTitleLabel setTextColor:RGB(51, 51, 51)];
[serviceTitleLabel setBackgroundColor:[UIColor clearColor]];
[serviceTitleLabel setTextAlignment:NSTextAlignmentLeft];
[contentView addSubview:serviceTitleLabel];
statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 30, 200, 30)];
[statusLabel setFont:[UIFont SingPostBoldFontOfSize:12.0f fontKey:kSingPostFontOpenSans]];
[statusLabel setTextColor:RGB(125, 136, 149)];
[statusLabel setBackgroundColor:[UIColor clearColor]];
[contentView addSubview:statusLabel];
costLabel = [[UILabel alloc] initWithFrame:CGRectMake(216, 20, 85, 30)];
costLabel.right = contentView.right - 15;
[costLabel setFont:[UIFont SingPostBoldFontOfSize:16.0f fontKey:kSingPostFontOpenSans]];
[costLabel setTextColor:RGB(51, 51, 51)];
[costLabel setTextAlignment:NSTextAlignmentRight];
[costLabel setBackgroundColor:[UIColor clearColor]];
[contentView addSubview:costLabel];
크기가 라벨의 크기에 따라 크기를 조정할 수 있도록 우리가 어떻게 UITableViewController
에서 조정할 수 있습니다? 셀과 테이블 뷰 모두에서 설정해야합니까? 어떤 도움이라도 대단히 감사합니다. 감사.
지금이 화면입니다. 하지 못
를 추가 – ddb
안녕은 동적있는 tableview가의 데이터가 함께 항목의 배열에서 (3 레이블은 항목 속성입니다) –
각 셀의 맞춤 높이가 있어야하거나 계산 된 높이가 모든 셀에 유효해야합니다. – ddb