CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

DJWSegmentedViewController 0.0.2

DJWSegmentedViewController 0.0.2

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

Maintained by Dan Williams.




A container view controller that manages multiple view controllers, which are swapped between using a segmented control.

The segmented control can be placed either in the navigation bar, as a navigation controller's titleView property, or alternatively, in the toolbar.

Ideal for use in applications that utilise a tabBarController, and is similar to the approach Apple uses in it's App Store app.

Demo

Screenshot

Usage

Create a new instance of DJWSegmentedViewController, utilising the designated initialiser, objective-c - (instancetype)initWithControlPlacement:(DJWSegmentedViewControllerControlPlacement)placement;, and then set its dataSource, and optionally, its delegate.

Creation

DJWSegmentedViewController *segmentedViewController = [[DJWSegmentedViewController alloc] initWithControlPlacement:DJWSegmentedViewControllerControlPlacementNavigationBar];
segmentedViewController.dataSource = self;
segmentedViewController.delegate = self;

DataSource

Implement the required dataSource methods:

- (NSInteger)numberOfViewControllers;

- (UIViewController *)DJWSegmentedViewController:(DJWSegmentedViewController *)segmentedViewController viewControllerAtIndex:(NSInteger)index;

- (NSString *)DJWSegmentedViewController:(DJWSegmentedViewController *)segmentedViewController segmentedControlTitleForIndex:(NSInteger)index;

Delegate

Both delegate methods are optional:

- (void)DJWSegmentedViewController:(DJWSegmentedViewController *)segmentedViewController willMoveToViewControllerAtIndex:(NSInteger)newIndex;

- (void)DJWSegmentedViewController:(DJWSegmentedViewController *)segmentedViewController didMoveToViewControllerAtIndex:(NSInteger)newIndex;

Installation

Simply add DJWSegmentedViewController to your Podfile if you're using Cocoapods. Alternatively, add DJWActionSheet.h and DJWActionSheet.m to your project. Included in this repository is a demo application, showing the project in action.

License

DJWSegmentedViewController is licensed under the MIT License