Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一组单选按钮(矩阵),它有 4 个选择。我怎样才能找出选择是什么(以编程方式)并获得它的 BOOL?
假设您的单选按钮矩阵已命名matrix并且类型为NSMatrix *,您可以通过 NSMatrix 的selectedCell方法找到选定的 NSButton,然后通过 NSButton 的state方法访问按钮的状态,如下所示:
matrix
NSMatrix *
selectedCell
state
BOOL state = [[matrix selectedCell] state];