我的用户界面有四个按钮,它们都会分享一些常见的行为,比如跟踪区域创建这样的事情.我正在寻找的是一个解决方案,所以我不必这样做:
@interface MyController : NSWindowController { NSButton * button1; NSButton * button2; NSButton * button3; NSButton * button4; } @property (nonatomic) IBOutlet NSButton * button1; @property (nonatomic) IBOutlet NSButton * button2; // and so on @end
@interface MyController : NSWindowController { NSMutableArray * buttons; } @property (nonatomic) IBOutlet NSMutableArray * buttons; // tell interface builder to place all buttons here @end
这可能吗?@H_404_5@