https://github.com/codecademy/storyboardxibcontroller
a View Controller for loading Xibs from your Storyboards
https://github.com/codecademy/storyboardxibcontroller
Last synced: 8 months ago
JSON representation
a View Controller for loading Xibs from your Storyboards
- Host: GitHub
- URL: https://github.com/codecademy/storyboardxibcontroller
- Owner: Codecademy
- License: mit
- Created: 2014-04-03T03:20:45.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2022-04-05T11:49:52.000Z (almost 4 years ago)
- Last Synced: 2024-09-19T00:02:36.465Z (over 1 year ago)
- Language: Objective-C
- Size: 196 KB
- Stars: 7
- Watchers: 30
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
StoryboardXibController
===
[](http://cocoadocs.org/docsets/StoryboardXibController/)
[](http://cocoadocs.org/docsets/StoryboardXibController/)
[](http://cocoadocs.org/docsets/StoryboardXibController/)
**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.
Installation
---
**StoryboardXibController** is available through **[cocoapods](http://cocoapods.org)**, to install simple add the following line to your `PodFile`:
``` ruby
pod "StoryboardXibController"
```
Alternatively you can clone the **[github repo](https://github.com/Codecademy/StoryboardXibController)**.
Setup
---
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.

* Add a second attribute with the **Key Path** `screenNib` of **Type** `String` with the `Value` of the name of the `Xib` file you wish to load.

* Enjoy!
Additional Configuration
---
* To align the contained view with the Top Layout Guide or Bottom Layout Guide toggle the two view controller properties:
* `Align To Top Layout Guide`
* `Align To Bottom Layout Guide`

* Or if you're pre-Xcode6 add attributes of `BOOL` value with the **Key Paths**:
* `alignToTopLayoutGuide`
* `alignToBottomLayoutGuide`
Thanks to [@fatuhoku](https://github.com/fatuhoku) for the idea and assistance in developing the feature.
Contributing
---
If you have any ideas, suggestions or bugs to report please [create an issue](https://github.com/Codecademy/StoryboardXibController/issues/new) labeled *feature* or *bug* (check to see if the issue exists first please!). Or suggest a pull request!