OSX Lion 中的 NSWindowController 已弃用 NSWindow
我有一个子类定义如下,
#import <Cocoa/Cocoa.h>
@interface ICMusicBrowserWindowController : NSWindowController
{
}
然后我创建上述子类的一个实例,如下所示
ICMusicBrowserWindowController *musicBrowserWindowController = [[ICMusicBrowserWindowController alloc] initWithWindowNibName:@"Browser"];
[musicBrowserWindowController setDelegate:self];
我尝试从 musicBrowserWindowController
请求 window
,如下所示。
[NSApp beginSheet:[musicBrowserWindowController window]
modalForWindow:[[self view] window]
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:nil];
然而,这样做时,我收到警告消息,窗口可能已弃用,因为接收器类型未知
。
关于我做错了什么有什么建议吗?我注意到这条警告消息只出现在 OSX Lion 中。谢谢。
I have a subclass defined as follows,
#import <Cocoa/Cocoa.h>
@interface ICMusicBrowserWindowController : NSWindowController
{
}
I then create an instance of the above subclass as follows
ICMusicBrowserWindowController *musicBrowserWindowController = [[ICMusicBrowserWindowController alloc] initWithWindowNibName:@"Browser"];
[musicBrowserWindowController setDelegate:self];
I try to ask for window
from musicBrowserWindowController
like so.
[NSApp beginSheet:[musicBrowserWindowController window]
modalForWindow:[[self view] window]
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:nil];
However when doing so, I get the warning message, window maybe deprecated because receiver type is unknown
.
Any suggestions as to what I am doing wrong? I noticed this warning message only appeared in OSX Lion. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新:我只是将 NSWindowController 子类的标头放入我使用 [实例窗口] 的类中
并且警告消失了...(我还将 NSWindowController 子类的前向声明 @Class 放入我使用它的标头中)其中一个或两个修复了警告...所以尝试一下。
所以我现在相信我之前的答案是错误的。
update: i just put the header of my subClass of NSWindowController into the class where i was using the [instance window]
and the warning went away... (i had also put in forward declaration @Class of my subclass of NSWindowController into the header of where i was using it) one or both of these fixed the warning... so try that.
so my previous answer was off i now believe.