Skip to content
This repository was archived by the owner on Jul 27, 2020. It is now read-only.

iDay/FHSegmentedViewController

Repository files navigation

FHSegmentedViewController

1 2 3

Requirements

  • iOS 6.1+
  • ARC

Installation

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]; }

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •