调用的故事板位于所有打开的窗口的后面 [英] invoked storyboard is coming behind all opened window

查看:81
本文介绍了调用的故事板位于所有打开的窗口的后面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In a cocoa application i have invoked one storyboard on certain events like button click using :

NSStoryboard *storyBoard = [NSStoryboard storyboardWithName:@"SendStoryboard" bundle:nil]; 
NSWindowController *myController = [storyBoard instantiateControllerWithIdentifier:@"SendIdentifier"]; 
[myController showWindow:nil];

此代码可以调用情节提要,但我不明白为什么它会出现在其他窗口后面已在finder中打开。
,请帮助我解决问题。我只希望它位于每个窗口的顶部。

this code is capable of invoking storyboard but i didn't understand why it is coming behind other windows which are already opened in finder. please help me to resolve the problem. I only want it to be on the top of every window.

推荐答案

使用以下代码:

- (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];

这篇关于调用的故事板位于所有打开的窗口的后面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆