表视图委托协议有一个tableView:heightOfRow,它允许您设置表视图中每行的高度.
感谢大家的建议和帮助。现在使用以下代码解决了这个问题tableView:heightOfRow:
float colWidth = [[[tableView tableColumns] objectAtIndex:1]width];
NSString *content = [[[tempArray objectAtIndex:row] objectForKey:@"tValue"] string];
float textWidth = [content sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSFont fontWithName:@"Lucida Grande" size:15],NSFontAttributeName ,nil]].width;
float newHeight = ceil(textWidth/colWidth);
newHeight = (newHeight * 17) + 13;
if(newHeight < 47){
return 47;
}
return newHeight;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3507 次 |
| 最近记录: |