Question

I can't get it to show any alert if I try to use a not allowed extension. When I say "not allowed" I mean I wrote

setAllowsOtherFileTypes:FALSE

but it doesn't work. If I set the allowed file types to an array of @"jpg" and @"png" (for example), and then I try to save "file.tif", I get no alert and the resulting filename is "file.tif.jpg" What's happening? I'm on MacOS 10.6.8, Xcode 3.2.6

Thank you very much

Was it helpful?

Solution

NSSavePanel* savepanel = [NSSavePanel savePanel];
 // set the save panel to only do jpg and png file
    [savepanel setAllowedFileTypes:[NSArray initWithObjects:@"jpg", @"png",nil]];
    [savepanel setAllowsOtherFileTypes:YES];
 // run the panel
if ([savepanel runModal] != NSFileHandlingPanelOKButton)
  return NO;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top