使用* .nib文件显示模态窗口 [英] Show modal window using *.nib file

查看:126
本文介绍了使用* .nib文件显示模态窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有prefs窗格应用程序,需要使用特定的nib文件显示模态窗口。



我使用方法:

  [NSBundle loadNibNamed:@___ NibName___owner:self]; 

没关系,但是窗口不是模式窗口/ p>

我应该做什么使这个窗口模式(用户不应该有访问prefs窗格窗口,直到当前窗口将不会关闭)。



谢谢!

解决方案

最简单的做法和管理方法:创建一个新的NSWindowController,类作为文件的所有者在您的自定义nib / xib中,将窗口出口连接到nib / xib中的窗口,获取窗口引用首先创建一个类的实例,然后使用

  NSWindow * window = instance.window; 

然后使用NSApplication的



$ p> runModalForWindow:


I have prefs pane application, and need to show modal window using specific nib file.

I use method:

[NSBundle loadNibNamed:@"___NibName___" owner:self];    

It's all right, but window is not modal( I can get access to prefs pane window ).

What should i dot to make this window modal( user should not have acces to prefs pane window, until current window will not be closed ).

Thanks!

解决方案

Easiest way to do and manage afterwards: create a new NSWindowController, set this class as File's owner in your custom nib/xib, connect the window outlet to your window within the nib/xib, get the window reference by first creating an instance of your class and then using

NSWindow *window = instance.window;

Then run it modal with NSApplication's

runModalForWindow:

这篇关于使用* .nib文件显示模态窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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