Skip to content

FGSegmentedControlViewController is a container view controller that manages view controllers through a UISegmentedControl interface.

License

Notifications You must be signed in to change notification settings

FernGlow/FGSegmentedControlViewController

Repository files navigation

FGSegmentedControlViewController is a container view controller that manages view controllers through a UISegmentedControl.

Screenshots

FGSegmentedControlViewController

Getting Started

1. Subclass the controller and optionally adopt the delegate protocol

@interface ExampleViewController : FGSegmentedControlViewController <FGSegmentedControlViewControllerDelegate>

2. Set the view controllers you want to manage with a segmented control

// Create view controllers to switch between
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:[NSBundle mainBundle]];
SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:[NSBundle mainBundle]];
ThirdViewController *thirdViewController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:[NSBundle mainBundle]];

// Set root view controllers
[self setViewControllers:@[firstViewController,secondViewController,thirdViewController]];

3. Insert the segmented control into the desired view

self.navigationItem.titleView = self.segmentedControl;

The segmented control can be placed in any view.

  • As the titleView property of a UINavigationController
  • As a UIBarButtonItem in a UIToolbar
  • As subview of another view

Documentation

Read the full documentation

Requirements

  • iOS 5.1.1
  • Apple LLVM 4.0+ (ARC, auto-synthesize, literals and subscripting)

Contributions

Feel free to fork and submit pull requests. This project is very early in development and I'm open to any improvements.

License

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

About

FGSegmentedControlViewController is a container view controller that manages view controllers through a UISegmentedControl interface.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages