Christoffer
Christoffer

Reputation: 26845

Cannot create NSImageView through Interface Builder in Xcode 4

I have found several tutorials describing the possibility to add an NSImageView with Interface Builder just like you can add an UIImageView in iOS.

However, in Xcode 4.1 the control doesn't seem to exist. I can create NSImageView's programmatically but it's not very practical for very graphical interfaces. I have something called IKImageView but with it I cannot set the image content through interface builder.

Can I get the NSImageView to appear in Interface Builder somehow?

Thanks.

Upvotes: 6

Views: 2542

Answers (3)

Mirror318
Mirror318

Reputation: 12693

The common way is to use a custom view for IB stuff, and programmatically have it contain an NSImageView (possibly with the same frame if you don't want to add other stuff). Custom view is just an empty view to contain basic frame/structure information.

Create your own class (subclassing NSView) containing an NSImageView, and in IB set your custom view's class to your custom class. Now you can make changes programmatically or through IB.

Upvotes: 1

Jon Hess
Jon Hess

Reputation: 14247

A second mechanism for creating an NSImageView is to drag an image directly out of the media library to some containing view in your canvas. Most places where you drop it will result in an NSImageView being created to host the image.

Upvotes: 6

Maurice Kelly
Maurice Kelly

Reputation: 1472

Look for the Image Well control in the Object Library - the underlying class for Image Well is NSImageView.

BTW - if you type in the search bar below the Object Library it will give you matches based on the classes which back the controls as well as on the names of the controls. If you're only scrolling through the Object Library you can easily miss the class names.

Upvotes: 14

Related Questions