我从Zarra/Long的“核心动画”一书中得到了这个代码。由于以下错误,它将无法编译:“不推荐使用‘runModalForTypes’”
- (IBAction)setMovieLocation:(id)sender {
NSOpenPanel *openPanel;
openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseDirectories: NO];
[openPanel setAllowsMultipleSelection: NO];
[openPanel setResolvesAliases: NO];
[openPanel setCanChooseFiles: NO];
if ([openPanel runModalForTypes:nil] == NSOKButton)
{
[[qcLayer setValue:openPanel filename]
forInputKey:[@"movie_location" ;]]
}
}有可能解决问题吗?
发布于 2014-06-23 08:20:13
由于NSOpenPanel继承自NSSavePanel,您会发现这个方法适合:
if ([openPanel runModal] == NSOKButton)请参阅NSSavePanel和NSOpenPanel的文档
https://stackoverflow.com/questions/24346317
复制相似问题