TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Aug 2015 |
Maintained by David Fu.
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 use SMBCustomRelationshipSegue
make your storyboard continuous and meaningful
RESideMenu
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
.
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 format
relationship_{{propertyName}}"
one to many
relationship should name with format
relationship_{{propertyName}}_{{index}}
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 +
David Fu, [email protected]
SMBCustomRelationshipSegue is available under the MIT license. See the LICENSE file for more info.