/THSegmentedPager

Simple plugin-sample using the HMSegmentedControl and a UIPageViewController to show Tabs

Primary LanguageObjective-COtherNOASSERTION

THSegmentedPager

Pod Version Pod Platform Pod License

This control combines the great HMSegmentedControl with a UIPageviewController that takes care of showing the right page when clicking on the HMSegmentedControl and updating the selection when the UIPageviewController scrolls.

Screenshots

iPhone Portrait iPhone Landscape

Installation

CocoaPods

Install with CocoaPods by adding the following to your Podfile:

platform :ios, '6.1'
pod 'THSegmentedPager', '~> 0.0.4'

Note: We follow http://semver.org for versioning the public API.

Manually

Or copy the THSegmentedPager/ directory from this repo into your project.

Features

V0.0.4

  • The control is now able to allocate viewcontrollers from the actual storyboard by just knowing a list of identifiers

Usage

This is a sample initialization taken from the ExampleProject.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    THSegmentedPager *pager = (THSegmentedPager *)self.window.rootViewController;
    NSMutableArray *pages = [NSMutableArray new];
    for (int i = 1; i < 4; i++) {
        // Create a new view controller and pass suitable data.
        SamplePagedViewController *pagedViewController = [pager.storyboard instantiateViewControllerWithIdentifier:@"SamplePagedViewController"];
        [pagedViewController setViewTitle:[NSString stringWithFormat:@"Page %d",i]];
        [pagedViewController.view setBackgroundColor:[UIColor colorWithHue:((i/8)%20)/20.0+0.02 saturation:(i%8+3)/10.0 brightness:91/100.0 alpha:1]];
        [pages addObject:pagedViewController];
    }
    [pager setPages:pages];
    return YES;
}

#Contributions

...are really welcome. If you have an idea just fork the library change it and if its useful for others and not affecting the functionality of the library for other users I'll insert it

License

Source code of this project is available under the standard MIT license. Please see the license file.