【发布时间】:2013-10-26 03:10:56
【问题描述】:
我正在尝试替换已弃用的
[NSBundle loadNibNamed:@"Subscriptions" owner:self];
用这个代替(唯一我能找到的东西是等效的)
[[NSBundle mainBundle] loadNibNamed:@"Subscriptions" owner:self topLevelObjects:nil];
但对话框会立即弹出并消失,而不是像处理已弃用的调用那样保持打开状态。
这段代码在这样的视图控制器中。
- (id)init{
self = [super init];
if (self) {
//[NSBundle loadNibNamed:@"Subscriptions" owner:self];
[[NSBundle mainBundle] loadNibNamed:@"Subscriptions" owner:self topLevelObjects:nil];
}
return self;
}
我像这样从 appdelegate 调用它。
SubscriptionsViewController *subscriptionsViewController = [[SubscriptionsViewController alloc] init];
[subscriptionsViewController.window makeKeyAndOrderFront:self];
我有什么遗漏吗?这对我来说似乎很直接。
【问题讨论】:
-
我也遇到了同样的问题,请问您找到解决办法了吗
标签: objective-c macos cocoa nsbundle