Reputation: 2085
This is probably something simple that I am missing but this is what is happening:
I am making a Menu item app (application is agent = YES)
So I have a MainViewAppDelegate that kind of runs the entire thing. It gets a detection when a button on the menu item gets clicked.
Then I have an upload NSWindowController:
#import <Cocoa/Cocoa.h>
@interface UploadView : NSWindowController
- (IBAction)upload:(id)sender;
@end
.m:
-(id)init {
if (! (self = [super initWithWindowNibName:@"UploadView"])) {
// Initialization code here.
return nil;
}
return self;
}
In MainViewAppDelegate, when that button is pressed I do:
if (!uploadView) {
uploadView = [[UploadView alloc] init];
}
[uploadView showWindow:self];
Now, this works as long as I don't click out of xcode. Once I do that (say I make chrome the active tab) then it does not work anymore even if I go back to xcode.
Any thoughts?
Upvotes: 0
Views: 296
Reputation: 2085
All I had to add was:
[NSApp activateIgnoringOtherApps:YES];
before trying to open the window.
Upvotes: 0
Reputation: 202
I dont see any issue in the UploadView code. But can you try connecting the UploadView Panel in xib to File's Owner window outlet and try. I created a similar demo now and tried and i dont see any issue.
Upvotes: 1