我从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" ;]]
}
}
有可能修复吗?
答案 0 :(得分:0)
当NSOpenPanel
继承自NSSavePanel
时,您会发现此方法适合:
if ([openPanel runModal] == NSOKButton)
的文档