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.
如何禁用按钮矩阵中的几个 NSButton?每个按钮都有一个特定的标签和标题。要实现此功能,按钮应该有边框还是无边框?
您可以IBOutlet为NSMatrix.
IBOutlet
NSMatrix
然后 :
[[self.buttonMatrix cellWithTag:1] setEnabled:NO];
对其他人也是如此。代替tag,您还可以使用title
tag
title
编辑,循环执行
for (NSButtonCell *button in [self.matrix cells]) { if (button.tag==1) { [button setEnabled:NO]; } }