cocoaimagekit

Selecting iPhoto images within a cocoa application


I was wondering what the best way of selecting photos from iPhoto within a cocoa application? Right now, the open file dialogue doesn't allow me to go into the iPhoto library. How can I allow the user to go into that folder? IKPictureTaker was one option, but it appears that it allows the selection of one picture at a time. I'd like a user to be able to select 1 picture, or many.


Solution

  • Just use NSOpenPanel and set the allowed file types to the public.image UTI:

    [panel setAllowedFileTypes:[NSArray arrayWithObject:@"public.image"]];
    

    This will automatically add a Media section and Photos item to the sidebar in the open panel that allows the user to select from their iPhoto library.

    Alternatively, you can use Karelia's open-source iMedia Browser.