macoscocoaimagekit

Cocoa Image Picker Popover


Several places in OS X (in this example, the Users & Groups pane in System Preferences) have circular image views that allow the user to either drag in an image, like in an editable NSImageView but also allow them to click to show a popover that allows various other choices of image sources.

I have checked the ImageKit framework, but the only thing I found similar is the image taking sheet.

image view image editing popover

How can I make use of this feature in my own Cocoa applications? I'd imagine it is implemented in some standard framework—but any pointers on implementing something like this would be quite appreciated.


Solution

  • You will have to go down the custom control root as this is not available as a stand alone control.

    However you have all the prerequisites.

    1. The circular image view

    There a several ways to implement this. You could try using a standard Cocoa button and customise as needed. Although it might just be easier to build from scratch by subclassing NSView. This was you can avoid all the NSCell stuff. I would do the latter.

    1. The popover

    Roll your own master-details type view controller to be displayed as the popover's content. In the left have a NSTableView (the master), the right have a NSCollectionView (the details). Below the collection view add some buttons.