fhs

FHSegmentedViewController

Custom view controller container for swiching sub view controller with a segmented control

Showing:

Popularity

Downloads/wk

0

GitHub Stars

111

Maintenance

Last Commit

6yrs ago

Contributors

4

Package

Dependencies

0

License

MIT

Categories

Readme

FHSegmentedViewController

1 2 3

Requirements

  • iOS 6.1+
  • ARC

Installation

From CocoaPods

pod 'FHSegmentedViewController'

From source

  • Drag the FHSegmentedViewController folder to your project

Getting Started

  1. Create a subclass of FHSegmentedViewController in your project
#import "FHSegmentedViewController.h"

@interface MasterViewController : FHSegmentedViewController

2.Implement - (void)viewDidLoad

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self setViewControllers:@[[self.storyboard instantiateViewControllerWithIdentifier:@"firstSubViewController"], [self.storyboard instantiateViewControllerWithIdentifier:@"secondSubViewController"]]];
}
  1. Push an instance of AnotherViewController.
    UIViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"firstSubViewController"];
    [self pushViewController:viewController title:@"anotherViewController"];

Note: If the view controller you want to present is a UITableViewController you have to override didMoveToParentViewController:in it with this:

    - (void)didMoveToParentViewController:(UIViewController *)parent
    {
        if (parent) {
            CGFloat top = parent.topLayoutGuide.length;
            CGFloat bottom = parent.bottomLayoutGuide.length;

            if (self.tableView.contentInset.top != top) {
                UIEdgeInsets newInsets = UIEdgeInsetsMake(top, 0, bottom, 0);
                self.tableView.contentInset = newInsets;
                self.tableView.scrollIndicatorInsets = newInsets;
            }
        }

        [super didMoveToParentViewController:parent];
    }

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100