cocoa - 如何知道 NSMatrix 中选择了多少行和列?

标签 cocoa nsmatrix

如何知道 NSMatrix 中选择了多少行和列?我尝试了很多方法,但都不起作用。

我考虑首先通过调用 NSMatrixselectedCells 方法来获取选定的单元格,但后来我不知道该怎么做。我应该在每个单元格实例中的某个位置保存它在 NSMatrix 中的位置(行/列)?还有其他解决办法吗?

最佳答案

您可以通过执行以下操作了解有多少个被选中:

NSArray *selectedArray = [myMatrix selectedCells];
NSUInteger selectedNum = [selectedArray count];

其中 myMatrix 是您的 NSMatrix 实例。

关于cocoa - 如何知道 NSMatrix 中选择了多少行和列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5784269/

相关文章:

c - 如何将此 C 日历代码转换为 Objective-C 语法并使其与矩阵一起使用

macos - 操作系统: How to have a dedicated application for managing the preferences of another one

cocoa - CGDisplayCapture 和系统按键事件

objective-c - 创建 NSImageCells 的 NSMatrix

cocoa - NSMatrix 隐藏在 10.7 Lion 上

objective-c - 以编程方式选择 NSMatrix 的项目

ios - NSRunLoop的runMode :beforeDate: - the correct approach for setting the "beforeDate"

macos - Mac Cocoa 应用程序中的 NSURLConnection 有连接限制吗?

iphone - cocoa touch 显示屏 多种货币