What I describe below works
1) Create xib and .h / .m files for your custom view.
1a) Assuming that you need IBOutlets to view the items you want to manage, give the File Owner the class name specified in your .h file in the identity inspector.
2) In the .h file, define the property
@property (nonatomic, retain) IBOutlet UIView *contentView;
2a) define exit points for all the routines in your xib that you want programmatic access to.
3) In the .m file, synthesize the property and make
- (void)awakeFromNib { NSLog(@"awake from nib"); [[NSBundle mainBundle] loadNibNamed:@"yourNibName" owner:self options:nil]; [self addSubview:self.contentView]; }
4) Drag empty views from the palette to their container in the storyboard. Change the class of these views to the class name defined in your .h file.
When you launch the application, you should see the xib contents in your subzones.
5) Now you can define the output in your custom subview instances in the .h file in the container view and include them, as usual, in the storyboard.
source share