Code: Custom UIView from xib

If you are building a complex view, you can break it down in parts to make more readable the code and split the functionality on different UIView classes. Then you can instantiate your subviews from your main UIViewController.

CustomView.xib

Create your xib file with you own design and don’t forget set up as “CustomView” in the identity inspector.

customView

CustomView.h

 

CustomView.m

In your view controller:

That’s it, an easy way to load and manage custom views.