makeKeyAndOrderFront を使用して、あるウィンドウから別のウィンドウを開こうとしています。新しいウィンドウが表示されますが、フォーカスがありません。
メイン ウィンドウのコードは次のとおりです。
#import "SecondWindowController.h"
@implementation FirstWindowController
-(IBAction)showSecondWindow:(id)sender
{
if (!secondWindowController)
secondWindowController = [[SecondWindowController alloc] init];
[[secondWindowController window] makeKeyAndOrderFront:self];
}
次のように、SecondWindowController は NSWindowController です。
@implementation SecondWindowController
-(id)init
{
if (![super initWithWindowNibName:@"SecondWindow"])
return nil;
return self;
}
[secondWindowController showWindow:self]
の前にも入れてみましたmakeKeyAndOrderFront
が、違いはありません。