JUCE
JUCE copied to clipboard
handle canSelectDirectories in iOS native FileChooser
Use canSelectDirectories flag in iOS native FileChooser
My initial try-out with this does not give the expected results. The file browser view changes from Icons to List (that I can't change to Icons view anymore) and the files are not displayed; only directories. I'm initializing like this:
typedef juce::FileBrowserComponent flags;
auto chooserFlags = flags::canSelectFiles |
flags::canSelectDirectories |
flags::canSelectMultipleItems |
flags::openMode;fileChooser->launchAsync(
chooserFlags, [&_mpc](const juce::FileChooser &chooser) { /* do stuff */ }
Been playing a bit in an Objective C playground app and with UIDocumentBrowserViewController
I get the desired result -- I can select multiple files and directories using this code:
#import "ViewController.h"
#include <CoreServices/UTType.h>
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidAppear:(BOOL)animated {
NSArray *utis = @[ (NSString *)UTTypeItem ];
UIDocumentBrowserViewController *picker =
[[UIDocumentBrowserViewController alloc] initForOpeningContentTypes:utis];
[self presentViewController:picker animated:YES completion:nil];
}
@end
The same code with UIDocumentPickerViewController
reproduces JUCE's behaviour.