IBAction导致NSOpenPanel模态自动关闭吗?

时间:2016-06-01 01:33:32

标签: objective-c cocoa nsopenpanel

为什么在函数load中调用[openPanel runModal]:导致openpanel自动关闭?它在调用函数加载时工作正常。

    navBar.pushNavigationItem(self.navigationItem, animated: NO)

更新

我在viewDidLoad

中创建了我的nsopenpanel
- (void)load {
    if ([self.openPanel runModal] == NSModalResponseOK) { //works correctly
        NSArray *files = [self.openPanel URLs];
    }
}

- (IBAction)load:(id)sender {
    if ([self.openPanel runModal] == NSModalResponseOK) { //returns immediately
        NSArray *files = [self.openPanel URLs];
    }
}

0 个答案:

没有答案