Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 调用的情节提要将出现在所有打开的窗口后面_Objective C_Xcode_Cocoa - Fatal编程技术网

Objective c 调用的情节提要将出现在所有打开的窗口后面

Objective c 调用的情节提要将出现在所有打开的窗口后面,objective-c,xcode,cocoa,Objective C,Xcode,Cocoa,在cocoa应用程序中,我在某些事件上调用了一个故事板,例如使用按钮单击: NSStoryboard *storyBoard = [NSStoryboard storyboardWithName:@"SendStoryboard" bundle:nil]; NSWindowController *myController = [storyBoard instantiateControllerWithIdentifier:@"SendIdentifier"]; [myController sh

在cocoa应用程序中,我在某些事件上调用了一个故事板,例如使用按钮单击:

NSStoryboard *storyBoard = [NSStoryboard storyboardWithName:@"SendStoryboard" bundle:nil]; 
NSWindowController *myController = [storyBoard instantiateControllerWithIdentifier:@"SendIdentifier"]; 
[myController showWindow:nil];
这段代码能够调用故事板,但我不明白为什么它会出现在finder中已经打开的其他窗口后面。 请帮我解决这个问题。我只希望它位于每个窗口的顶部。

使用以下代码:

- (void)windowDidLoad {
[super windowDidLoad];
NSRunningApplication* app = [NSRunningApplication
                             runningApplicationWithProcessIdentifier: pID];
[app activateWithOptions: NSApplicationActivateAllWindows];}
NSArray* apps = [NSRunningApplication
                 runningApplicationsWithBundleIdentifier:@"Your App BundleID"];
[(NSRunningApplication*)[apps objectAtIndex:0]
 activateWithOptions: NSApplicationActivateIgnoringOtherApps];

[[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
或使用以下代码:

- (void)windowDidLoad {
[super windowDidLoad];
NSRunningApplication* app = [NSRunningApplication
                             runningApplicationWithProcessIdentifier: pID];
[app activateWithOptions: NSApplicationActivateAllWindows];}
NSArray* apps = [NSRunningApplication
                 runningApplicationsWithBundleIdentifier:@"Your App BundleID"];
[(NSRunningApplication*)[apps objectAtIndex:0]
 activateWithOptions: NSApplicationActivateIgnoringOtherApps];

[[NSApplication sharedApplication] activateIgnoringOtherApps : YES];

它工作得很好,但有一次当我关闭故事板,并再次尝试在同一事件中调用它时,即使在程序完全执行之后,故事板也不可见,毫无例外。你能告诉我为什么会发生这种情况,以及如何解决它吗?你用断点检查过了吗。。?那个代码正在第二次执行?是的,有一次我尝试使用断点,我也尝试了不使用断点。