关于objective C:使 NSAlert 成为最顶层的窗口? | 珊瑚贝

Make a NSAlert the topmost window?


我已在我的应用程序中创建了主窗口以进行以下设置:

1
2
3
4
5
[self setLevel:kCGDesktopWindowLevel + 1];
[self setCollectionBehavior:
     (NSWindowCollectionBehaviorCanJoinAllSpaces |
      NSWindowCollectionBehaviorStationary |
      NSWindowCollectionBehaviorIgnoresCycle)];

这是一个非常自定义的窗口,有点浮在桌面上方。

此外,它是一个菜单栏应用程序 (LSUIElement)。

好的,所以如果出现问题,我需要显示警报。这是我的做法:

1
2
3
4
5
6
NSAlert *alert = [NSAlert alertWithMessageText:@“”
                                 defaultButton:@“”
                               alternateButton:@“”
                                   otherButton:@“”
                     informativeTextWithFormat:@“”];
[alert runModal];

当然我已经填写了按钮和其他文本。

这是我的问题:当我的应用程序当前不是关键应用程序,并且弹出此警报时,它不是关键窗口。像这样:

enter



来源:https://www.codenong.com/5269116/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_10098.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?