Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.70 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to use NSWorkspace to be able to open a filetype? - Cocoa
  2. #import <Cocoa/Cocoa.h>
  3.  
  4. @interface fileClickerAppDelegate : NSObject <NSApplicationDelegate> {
  5. NSWindow *window;
  6. NSTextField *fileName;
  7. }
  8.  
  9. @property (assign) IBOutlet NSWindow *window;
  10. @property (assign) IBOutlet NSTextField *fileName;
  11.  
  12. @end
  13.        
  14. #import "fileClickerAppDelegate.h"
  15.  
  16. @implementation fileClickerAppDelegate
  17.  
  18. @synthesize window;
  19. @synthesize fileName;
  20.  
  21. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
  22.  
  23. }
  24.  
  25. - (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames {
  26.  
  27.     [fileName setStringValue:[NSString stringWithFormat:@"Wow, even multiple files like %d :-)", [filenames count]]];
  28. }
  29.  
  30. @end