You can drag a UIView into a nib file and then use the identity inspector (command-opt-3) to change the class to any subclass of UIView.
You will need to set the subclasses in the initialization code that gets called when loading from nib, i.e. not in initWithFrame: If you are coding for completeness, both methods (programmatic and fundamentally based) should invoke the same initialization.
If you like it, just create addSubview: in the initialization code, and then implement layoutSubviews to layoutSubviews your own subzones. This will be called at any time when the image is resized and initially.
bshirley
source share