プログラムで作成したボタンは、基本的にクリックしても押されません。なぜですか?何も起こらず、アクションは実行されず、画像は代替画像に変更されません。
(私はMomentaryChangeButtonを使用していますが、MomentaryPushInに設定しました(プッシュしているかどうかを確認するためです。押し下げていません。)
NSButton *titleButton = [[NSButton alloc]initWithFrame:NSMakeRect(TITLE_BUTTON_X_OFFSET, TITLE_BUTTON_Y_OFFSET, TITLE_BUTTON_WIDTH, TITLE_BUTTON_HEIGHT)];
[titleButton setBordered:NO];
[titleButton setNeedsDisplay:YES];
[titleButton setImage:[NSImage imageNamed:TITLE_BUTTON_NAME]];
[titleButton setAlternateImage:[NSImage imageNamed:TITLE_BUTTON_PRESSED_NAME]];
[titleButton setButtonType:NSMomentaryChangeButton];
[self addSubview:titleButton];
NSButton *aboutButton = [[NSButton alloc]initWithFrame:NSMakeRect(ABOUT_BUTTON_X_OFFSET, ABOUT_BUTTON_Y_OFFSET, ABOUT_BUTTON_WIDTH, ABOUT_BUTTON_HEIGHT)];
[aboutButton setBordered:NO];
[aboutButton setNeedsDisplay:YES];
[aboutButton setButtonType:NSMomentaryChangeButton];
[aboutButton setImage:[NSImage imageNamed:ABOUT_BUTTON_NAME]];
[aboutButton setAlternateImage:[NSImage imageNamed:ABOUT_BUTTON_PRESSED_NAME]];
[[aboutButton image] setSize:NSMakeSize(ABOUT_BUTTON_WIDTH, ABOUT_BUTTON_HEIGHT)];
[[aboutButton alternateImage]setSize:NSMakeSize(ABOUT_BUTTON_WIDTH, ABOUT_BUTTON_HEIGHT)];
[self addSubview:aboutButton];
NSButton *settingsButton = [[NSButton alloc]initWithFrame:NSMakeRect(SETTINGS_BUTTON_X_OFFSET, SETTINGS_BUTTON_Y_OFFSET, SETTINGS_BUTTON_WIDTH, SETTINGS_BUTTON_HEIGHT)];
[settingsButton setBordered:NO];
[settingsButton setNeedsDisplay:YES];
[settingsButton setButtonType:NSMomentaryChangeButton];
[settingsButton setImage:[NSImage imageNamed:SETTINGS_BUTTON_NAME]];
[settingsButton setAlternateImage:[NSImage imageNamed:SETTINGS_BUTTON_PRESSED_NAME]];
[[settingsButton image] setSize:NSMakeSize(SETTINGS_BUTTON_WIDTH, SETTINGS_BUTTON_HEIGHT)];
[self addSubview:settingsButton];