setDirectoryURL is not working first time
Why NSOpenPanel, opens ~/Documents folder first time?
NSOpenPanel* restorePanel = [NSOpenPanel openPanel];
[restorePanel setCanCreateDirectories: YES];
[restorePanel setCanChooseDirectories:YES];
[restorePanel setCanChooseFiles:NO];
[restorePanel setAllowsMultipleSelection: NO];
[restorePanel setTitle:@"My app?"];
[restorePanel setNameFieldLabel:@"App to:"];
[restorePanel setPrompt:@"Choose"];
[restorePanel setDirectoryURL:[NSURL fileURLWithPath:ValidPath]];
NSLog(@"%@", [restorePanel directoryURL]); // ValidPath URL
If i will call
[[NSUserDefaults standardUserDefaults] setObject:restoreSaveFolder
forKey:@"NSNavLastRootDirectory"];
in awakeFromNib its working fine.
No comments:
Post a Comment