【发布时间】:2014-04-14 08:33:36
【问题描述】:
在 NSTableView 中有一个 NSTextField。
窗口大小调整中文本的高度增加。 但不会在表格视图中增长单元格。
在这种情况下,表格视图单元格的高度你喜欢怎么改变?
简而言之,当调整文本视图的大小时,我想改变单元格的大小。
像这样:(Mac 商店)
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row;
{
KFCustomCellView *cellView = [tableView makeViewWithIdentifier:@"MainCell" owner:self];
NSString *comment = [[_commentList objectAtIndex:row]valueForKey:@"COMMENT"];
[cellView.comment setStringValue:comment];
float cellheight = [comment heightForStringDrawing:comment font:[cellView.comment font] width:self.view.frame.size.width * 0.8];
if (cellheight > cellView.comment.frame.size.height)
{
return (cellheight + 65);
}
return 90;
}
【问题讨论】:
标签: objective-c cocoa nstableview