TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Ian Grossberg.
StoryboardXibController is a utility class made to separate complex view controllers and view data out of your storyboard and into your Xibs, all within Xcode's Interface Builder.
Using this class you can easily load an Xib from within a storyboard at runtime. Currently this is restricted to Xib files whose File's Owner is a UIViewController
or UIViewController
subclass.
StoryboardXibController is available through cocoapods, to install simple add the following line to your PodFile
:
pod "StoryboardXibController"
Alternatively you can clone the github repo.
Once you've installed the class:
Add a new view controller scene to your storyboard.
Find the Custom Class property within the view controller's Identity Inspector tab
Change the view controller's Custom Class from UIViewController
to StoryboardXibController
.
In Xcode 6:
Find the Screen Controller property within the view controller's Attributes Inspector tab
Change the view controller's Screen Controller to the name of the class of your Xib
's File's Owner/main view controller.
Find the Screen Nib property immediately below
Change the view controller's Screen Nib property to the name of the Xib
file you wish to load.
In Xcode 5 and below:
Find the User Defined Runtime Attributes within the same Identity Inspector tab
Add an attribute with the Key Path screenControllerClass
of Type String
with the Value of the name of the class of your Xib
's File's Owner/main view controller.
screenNib
of Type String
with the Value
of the name of the Xib
file you wish to load.Align To Top Layout Guide
Align To Bottom Layout Guide
BOOL
value with the Key Paths:
alignToTopLayoutGuide
alignToBottomLayoutGuide
Thanks to @fatuhoku for the idea and assistance in developing the feature.
If you have any ideas, suggestions or bugs to report please create an issue labeled feature or bug (check to see if the issue exists first please!). Or suggest a pull request!