Latest 0.1.1
Homepage https://github.com/SuperMarioBean/SMBCustomRelationshipSegue
License MIT
Platforms ios 7.0, requires ARC
Authors

[![CI Status](http://img.shields.io/travis/David Fu/SMBCustomRelationshipSegue.svg?style=flat)](https://travis-ci.org/David Fu/SMBCustomRelationshipSegue)
Version
License
Platform

Usage

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:

  1. 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 call awakeFromNib super implementation or the SMBCustomRelationShipSegue would not work.
RESideMenu‘s implementation overwrite the awakeFromNib and did not call the super implementation, I commit pull request, however I got no reply

  1. 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}}

Note: you should ensure the index is continuous and started with 0

then it’s OK! followings are screenshot building relationships:

SMBCustomRelationshipSegue

Requirements

iOS 7.0 and iOS 7.0 +

Installation

SMBCustomRelationshipSegue is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SMBCustomRelationshipSegue"

Author

David Fu, [email protected]

License

SMBCustomRelationshipSegue is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SMBCustomRelationshipSegue",
    "version": "0.1.1",
    "summary": "a simple implementation for custom relationship segue",
    "description": "SMBCustomRelationshipSegue is a simple implementation for custom relationship segue, enhance the custom container view controller in storyboard like UINavigationController or UITabbarController. if you are developer who like storyboard and want use it to show your view contorller logic on storyboard to make life easy, SMBCustomRelationshipSegue should be in your toolbox",
    "homepage": "https://github.com/SuperMarioBean/SMBCustomRelationshipSegue",
    "license": "MIT",
    "authors": {
        "David Fu": "[email protected]"
    },
    "source": {
        "git": "https://github.com/SuperMarioBean/SMBCustomRelationshipSegue.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "SMBCustomRelationshipSegue": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This