我面臨着在Mac中設置NSTextFieldCell
框架的問題。我的NSTextFieldCell
位於列的(0,0)點。我需要在y位置有4px的差距。以下是現有用戶界面的圖像。如何在NSTableView中設置NSTextFieldCell的框架
這裏是的.xib結構如下:
委託方法下,我想設置的框爲下:
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)aRow
{
if ([[aTableColumn identifier] isEqualToString:@"notes"])
{
[aCell setBackgroundColor:[NSColor redColor]];
NSTextFieldCell *theCellView = aCell;
NSView *controlView = [theCellView controlView];
NSRect frame = controlView.frame;
frame.origin.x = 120;
frame.origin.y = 130;
[controlView setFrame:frame];
}
}
表視圖應該是基於視圖還是基於單元格? – Willeke
謝謝@Willeke。它基於細胞。 – TechBee
單元格的controlView是表格視圖。 – Willeke