0
나는 UITableView를 가지고 있는데, 각 행은 라인이없는 곳에서부터 라인 수만큼 (실제로는 3-4 점)의 레이블을 가질 수있다. 행이 UILabelView 내용을 기반으로 확장되도록하고 싶습니다.UITableView 행을 동적으로 레이블만큼 넓게 만드는 방법은 무엇입니까?
지금까지이 있습니다
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat height = 60.0;
UIFont *font = [UIFont fontWithName:@"Helvetica-BoldOblique" size:10.0];
NSString *text = reminder.notes; //the text that will be in the UiLabelView
CGFloat notesHeight = [text sizeWithFont:font
constrainedToSize:CGSizeMake(250.0, 4000.0)
lineBreakMode:UILineBreakModeTailTruncation].height;
height += notesHeight;
return height;
}
난 아직도 터져 결과를 얻을 수 있습니다. 목표를 달성하기 위해 내가 할 수있는 일은 무엇입니까? 당신은 항상 한 줄을 초래할 것이며, sizeWithFont:constrainedToSize:lineBreakMode:
가 그 한 줄의 필요한 크기를 반환합니다 lineBreakMode로 UILineBreakModeTailTruncation
를 사용하는
+1 numberOFLines의 경우 +1입니다. – jini