Unable to create NSImageView through Interface Builder in Xcode 4

I found several tutorials that describe the ability to add NSImageView using Interface Builder in the same way you can add UIImageView in iOS.

However, in Xcode 4.1, controls do not seem to exist. I can create NSImageView programmatically, but it is not very practical for very graphical interfaces. I have something called IKImageView , but with this I can not set the contents of the image through the interface constructor.

Is there any way to display NSImageView in Interface Builder?

Thanks.

+6
source share
3 answers

Look at the management of the Image well in the object library - the base class for Image Well is NSImageView .

BTW - if you enter a search string under the library of objects, it will give you matches based on the classes that return the controls, as well as the names of the controls. If you are only scrolling through an object library, you can easily skip class names.

+14
source

The second mechanism for creating NSImageView is to drag an image directly from the media library to some containing view in the canvas. Most places where you delete it will result in an NSImageView to place the image.

+6
source

A common way is to use a custom view for IB material, and programmatically it contains an NSImageView (possibly with the same frame if you do not want to add other materials). A custom view is simply an empty view containing basic information about a frame / structure.

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

+1
source

Source: https://habr.com/ru/post/898618/


All Articles