我自定义 NSTableView 就像我在 UITableView 中所做的一样。我实现了数据源和委托。在代码中,我这样做:
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
ZJCellView *cellView = [tableView makeViewWithIdentifier:cellIdentifier owner:self];
//this is a custom view
if (cellView == nil)
{
CGRect rect = CGRectMake(0, 0, tableView.frame.size.width, kTableViewCellHeight);
cellView = [[[ZJCellView alloc] initWithFrame:NSRectFromCGRect(rect)] autorelease];
cellView.identifier = cellIdentifier;
// some other controls
}
return cellView;
我像在 iOS 中一样进行自定义。问题是左右边框都有一条线,例如:
我尝试更改单元格视图的框架,它似乎没有用。由于这是在 iOS 中自定义单元格的正确方法,我想知道在 Cocoa 中哪里错了。
有谁能够帮助我?谢谢。