0

我从 Zarra/Long 的 Core Animation 一书中得到了这段代码。由于以下错误,它将无法编译:“'runModalForTypes' is deprecated”

- (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" ;]]
}
}

有可能的解决方法吗?

4

1 回答 1

0

作为NSOpenPanel继承自NSSavePanel,您会发现此方法适合:

if ([openPanel runModal] == NSOKButton)

请参阅NSSavePanelNSOpenPanel的文档

于 2014-06-23T08:20:13.377 回答