为什么在函数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];
}
}