I have an NSOpenPanel with an accessory view. The accessory view is simple - it's a single checkbox that when checked, allows the user to select any file; when un-checked, requires the file to be one in the list of supported extensions.
NSOpenPanel initialization and display:
NSOpenPanel* dialog = [NSOpenPanel openPanel];
[dialog setAllowedFileTypes:allowedFileTypes];
[dialog setAccessoryView:openPanelAccessoryView];
openPanel = dialog;
[dialog beginSheetModalForWindow:[self activeWindow]
completionHandler:^(NSInteger result)
{
...
}];
IBAction for the checkbox:
- (void)openUnrecognizedFiles:(id)sender
{
if ([sender state])
[openPanel setAllowedFileTypes:nil];
else
[openPanel setAllowedFileTypes:@[@"dsk"]];
}
According to the documentation, one can use setAllowedFileTypes while the panel is displayed:
The allowed file types can be changed while the panel is running (for example, from an accessory view).
However, this does not seem work as expected: the current view does not reload - as you scroll, files further down do get enabled/disabled as appropriate for the new settings; however, files originally visible are unaffected.
I need some way to refresh the contents of the current directory when the user toggles the accessory view checkbox - however, I can't seem to find any way to do it. Any suggestions?
EDIT, Oct. 15, 2013: This seems to be caused by a bug in Mavericks more than anything else. Same code running on Mountain Lion works without any issues, just like the two commenters here noted.