Latest 1.0.0
Homepage https://github.com/bilby91/UIViewController-ChildControllers
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit
Authors

![CI Status](http://img.shields.io/travis/Martin Fernandez/ChildControllers.svg?style=flat)
Version
License
Platform

Usage

UIViewController+ChildControllers helps you out when you want to present child controllers.

Now you don’t have to remember calling willMoveToParentViewController: or didMoveToParentViewController, this will be done for you when you use this API.

The best place for looking at the documentation will be in the source code but basically this is what you can do.

First, create a view controller:

  UIViewController *viewControllerToPresent = [UIViewController new];
  viewControllerToPresent.view.backgroundColor = [UIColor redColor];

  UIView *containerView = [[UIView alloc] initWithFrame:self.view.frame];
  [self.view addSubview:containerView];

Present the view controller with the view pined to the edges of the container view:

  [self presentChildController:viewControllerToPresent inView:containerView];

Present the view controller and setup some constraints:

[self presentChildController:viewControllerToPresent inView:containerView constraintsBlock:^(UIView *containerView, UIView *newView) {
    [containerView addConstraint:[NSLayoutConstraint constraintWithItem:newView
                                                              attribute:NSLayoutAttributeTop
                                                              relatedBy:NSLayoutRelationEqual
                                                                 toItem:containerView
                                                              attribute:NSLayoutAttributeTop
                                                             multiplier:1.0
                                                               constant:3.f]];
  }];  

}

To run the example project, clone the repo, and run pod install from the Example directory first.

TODO

[ ] Add support for setting the view with it’s frame

Installation

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

pod "UIViewController+ChildControllers"

Author

Martin Fernandez, [email protected]

License

UIViewController+ChildControllers is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "UIViewController+ChildControllers",
    "version": "1.0.0",
    "summary": "UIViewController+ChildControllers helps you out when you need to present child controllers.",
    "homepage": "https://github.com/bilby91/UIViewController-ChildControllers",
    "license": "MIT",
    "authors": {
        "Martin Fernandez": "[email protected]"
    },
    "source": {
        "git": "https://github.com/bilby91/UIViewController-ChildControllers.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This