Created
June 14, 2014 14:07
-
-
Save cmendesce/4f9aecb87d75c3f38003 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Insert code here to initialize your application | |
| NSOpenPanel* openDlg = [NSOpenPanel openPanel]; | |
| // Enable the selection of files in the dialog. | |
| [openDlg setCanChooseFiles:NO]; | |
| // Multiple files not allowed | |
| [openDlg setAllowsMultipleSelection:NO]; | |
| // Can't select a directory | |
| [openDlg setCanChooseDirectories:YES]; | |
| // Display the dialog. If the OK button was pressed, | |
| // process the files. | |
| if ( [openDlg runModal] == NSOKButton ) | |
| { | |
| // Get an array containing the full filenames of all | |
| // files and directories selected. | |
| NSArray* urls = [openDlg URLs]; | |
| // Loop through all the files and process them. | |
| for(int i = 0; i < [urls count]; i++ ) | |
| { | |
| NSString* url = [urls objectAtIndex:i]; | |
| NSLog(@"Url: %@", url); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment