I got this code from the book Core Animation from Zarra/Long. It will not compile due to the following error: "'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" ;]]
}
}
Is there a possible fix ?
As a NSOpenPanel
inherits from NSSavePanel
, you'll find this method suited:
if ([openPanel runModal] == NSOKButton)
See documentation for NSSavePanel and NSOpenPanel