探索表格视图与Cocoa绑定技术
1. 表格视图基础
在开发过程中,我们常常需要在表格视图中展示和管理数据。以一个简单的示例来说,我们有一个 VillainTracker 应用,用于管理反派角色的信息。在这个应用里,我们使用表格视图来展示反派角色的相关信息。
当表格视图要显示某个单元格时,会调用相应的方法。以下是部分代码示例:
} else if ([thisColName isEqualToString:kLastSeenDate]) {
NSTableCellView *thisCell = [aTableView makeViewWithIdentifier:thisColName owner:self];
thisCell.textField.stringValue = [thisVillain objectForKey:kLastSeenDate];
result = thisCell;
} else if ([thisColName isEqualToString:kMugshot]) {
NSImageView *thisCell = [aTableView makeViewWithIdentifier:thisColName owner:self];
[thisCell setImage:[thisVillain objectForKey:kMugshot]];
result = thisCell;
}
// return the result.
return result;
这个方法会根据
超级会员免费看
订阅专栏 解锁全文
19

被折叠的 条评论
为什么被折叠?



