SNFSegmentedViewController icon indicating copy to clipboard operation
SNFSegmentedViewController copied to clipboard

The simplest way to use a segmented control to switch between view controllers.

SNFSegmentedViewController

SNFSegmentedViewController is the simplest way to use a UISegmentedControl to switch between view controllers. You don't have to worry about view controller containment or setting up a kludge of custom empty segues. SNFSegmentedViewController just works.

Usage

Since SNFSegmentedViewController is a subclass of UITabBarController, all you have to do is:

  • Drag out a UITabBarController into a storyboard, and embed it in a UINavigationController.
  • Wire it up to your views appropriately.
  • Change its class to SNFSegmentedViewController.

It's that simple.

Installation

Add SNFSegmentedViewController to your Podfile if you're using CocoaPods, or add SNFSegmentedViewController.{h,m} into your project.

SNFSegmentedViewController requires iOS 6.0 and above, and it requires ARC.

Credits

SNFSegmentedViewController was created by Seth Friedman.

Special thanks to Bill Shirley for demonstrating how to hide the UITabBar.

License

SNFSegmentedViewController is available under the MIT license.

If you're using SNFSegmentedViewController in your project, I'd love to hear about it! Be sure to add it to the list.