Drag custom view onto window in Interface Builder? Drag custom view onto window in Interface Builder? xcode xcode

Drag custom view onto window in Interface Builder?


Interface Builder doesn't add (or allow the addition of, now that IB Plugins are derelict) Custom Objects to the Object Library. You can only drag in existing/preset objects, but you can have IB instantiate them as instances of a subclass as long as they are instantiated the same way.

E.g. Drag in a custom view and set the class to MyCustomViewClass, or drag in a scroll view and set the class to MyCustomScrollView, or drag in an object and set the class to CustomObject, et cetera.

And that is the preferred way of using custom controls in Interface Builder.

enter image description here


Basically just ripping off rdelmar's comment... but I thought a picture would be helpfulenter image description here

Drag a normal view into IB, then select it and do this.


Every Window you create in IB has a view on it as its first subcomponent. You dont need to create a separate custom view for it. If you really are subclassing it just change the class name in the inspector.