Ram*_*nka 18
通过使用selectedRow,请看这里:
@property(readonly) NSInteger selectedRow;
Run Code Online (Sandbox Code Playgroud)
最后一个选定行的索引(或添加到选择的最后一行).
您也可能对...有兴趣:
-selectedRowEnumerator(不建议使用)
-numberOfSelectedRows
-selectedRowIndexes"返回包含所选行索引的索引集"
Jos*_*zzi 15
Cocoa遵循模型 - 视图 - 控制器设计模式,因此您的推理以及您自己的设计也应该如此.
您没有从表中获取任何值,因为您已在模型中拥有它们.您的控制器(通常是数据源)向表中询问其选定的行索引,然后向您的模型询问与这些索引匹配的对象,然后执行它需要做的任何事情.
Boj*_*bic 10
假设您已经拥有名为tableView的属性,并且在xib中定义了带有行cellName的 tableView
NSInteger row = [tableView selectedRow];
NSTableColumn *column = [tableView tableColumnWithIdentifier:@"cellName"];
NSCell *cell = [column dataCellForRow:row];
NSLog(@"cell value:%@", [cell stringValue]);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19244 次 |
| 最近记录: |