[![CI Status](http://img.shields.io/travis/David Fu/SMBCustomRelationshipSegue.svg?style=flat)](https://travis-ci.org/David Fu/SMBCustomRelationshipSegue)
To run the example project, clone the repo, and run pod install
from the Example directory first.
I've managed to make the custom container view controller set up relationship with its child view controllers looks as Apple’s UINavigtaionController or UITabbarController do in storyboard.
there are two examples in example folder:
-
sidemenu
this example uses
RESideMenu
as a custom container view controller to show how to useSMBCustomRelationshipSegue
make your storyboard continuous and meaningfulRESideMenu
is a very beautiful custom container view controller and here is the link -
container
this example is inspired by objc.io’s Custom Container View Controller Transitions and the repo is here. In that repo, the project implement the custom container view controller without any interface file, and I update it with
SMBCustomRelationshipSegue
, now the relationship between container view controller and child view controllers can be seen in storyboard
SMBCustomRelationshipSegue
now supports one to one
relationship(like UINavigationController’s rootViewController relationship segue) and one to many
relationship (like UITabbarController’s viewControllers relationship segue). all you need to do are just two steps:
-
subclass your view controller or UIViewController, overwrite the method:
- (NSArray *)relationships
return the array of your property names which you want build a relationship, the lib will check it for you whether it is a one to one
or one to many
.
Note: if you overwrite the method
awakeFromNib
, you must callawakeFromNib
super implementation or theSMBCustomRelationShipSegue
would not work.RESideMenu
's implementation overwrite theawakeFromNib
and did not call the super implementation, I commit pull request, however I got no reply
-
you need control drag your storyboard. link a
custom relation ship
segue between container view controller and child view controllers. and name the segue identifier .-
one to one
relationship should name with formatrelationship_{{propertyName}}"
-
one to many
relationship should name with formatrelationship_{{propertyName}}_{{index}}
-
Note: you should ensure the index is continuous and started with 0
then it’s OK! followings are screenshot building relationships:
iOS 7.0 and iOS 7.0 +
SMBCustomRelationshipSegue is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SMBCustomRelationshipSegue"
David Fu, [email protected]
SMBCustomRelationshipSegue is available under the MIT license. See the LICENSE file for more info.