NGSegmentedViewController 0.1.1

NGSegmentedViewController 0.1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.




  • By
  • Nicky Gerritsen

NGSegmentedViewController: A segmented view controller

UIViewController subclass using SDSegmentedControl and View Controller Containment API's to switch between child view controllers

NGSegmentedViewController

(click to download a video of the controller in action).

Features

  • Uses View Controller Containment API's to display a list of view controllers
  • Uses the excellent SDSegmentedControl to display a view controller switcher at the top
  • Can be used with code and Interface Builder
  • Can be used with Autolayout
  • When using UITableView's or UICollectionView's automatically adjusts contentInset and scrollIndicatorInsets to accomodate for segmented control
  • Allows for a delegate to be notified when the selected view controller will / did change

Requirements

  • ARC
  • Xcode 4.4+ (needed for modern Objective-C syntax)
  • iOS 6+

Installation

Manually

Important note if your project doesn't use ARC: you must add the -fobjc-arc compiler flag to NGSegmentedViewController.m in Target Settings > Build Phases > Compile Sources.

  • Drag the NGSegmentedViewController/NGSegmentedViewController folder into your project
  • Download SDSegmentedControl and drag SDSegmentedControl.{h,m} into your project
  • Add the QuartzCore framework to your project
  • You might need to change the #import <SDSegmentedControl/SDSegmentedControl.h> in NGSegmentedViewController.h to #import "SDSegmentedControl.h"

Demos

I have added two demos. NGSegmentedViewController example uses code to set up a segmented view controller and NGSegmentedViewController IB example uses Interface Builder to set one up.

Note

As this is my first open source iOS control, it is possible that I made mistakes. Furthermore, I only implemented features that seemed useful to me. If you find any errors or want extra features, feel free to fork this project and sent in a Pull Request.

Usage

Instantiate a segmented view controller with initWithViewControllers: or initWithViewControllers:titles:.

When using Interface Builder, create a subclass and overwrite awakeFromNib to call setupWithViewControllers: or setupWithViewControllers:titles:.

License and copyright

All source code is licensed under the MIT-License.

Copyright 2013 Nicky Gerritsen.

Authors