Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom UIView built with Interface Builder accessible/positionable via Interface Builder

This shouldn't be this confusing. I have a custom UIView with a bunch on controls on it. UILabels, buttons, etc. I've created this Nib using Interface Builder. I want to be able to position this custom uiview on another UIView using the interface builder.

How do I link my UIView custom class, to the nib? initWithCoder gets called, but I want this class to get loaded from the nib.

Thanks

like image 807
Nader Avatar asked Nov 09 '09 00:11

Nader


2 Answers

For this to work, you have to create a plug-in for Interface Builder that uses your custom control's class. As soon as you create and install your plug-in, you will be able to add by drag and drop, instances of your view onto another window or view in Interface Builder. To learn about creating IB Plugins, see the Interface Builder Plug-In Programming Guide and the chapter on creating your own IB Palette controls from Aaron Hillegass's book, Cocoa Programming for Mac OS X.

Here is the link to the original author of the accepted answer to a similar question.

like image 135
luvieere Avatar answered Nov 08 '22 03:11

luvieere


You only need to make a plugin if you want the custom view to draw correctly in the nib you are using it. You can make a custom control and then have it show as a blank rectangle until instantiated during run right now.

How do I get a view in Interface Builder to load a custom view in another nib?

like image 38
CBGraham Avatar answered Nov 08 '22 03:11

CBGraham