Latest 1.1.2
Homepage https://github.com/nakajijapan/NKJPagerViewController
License MIT
Platforms ios 7.0, requires ARC
Authors

Version
License
Platform
Build Status

NKJPagerViewController is a PagerTabStrip, which is in Android.
It contains an endlessly scrollable UIScrollView.

This viewController inspired ICViewPager. The biggest of difference is to endlessly swipe page.

Requirements

NKJPagerViewController higher requires Xcode 6, targeting either iOS 7.1 and above, or Mac OS 10.10 OS X Yosemite and above.

Installation

CocoaPods

pod "NKJPagerViewController"

Usage

Implement as subclass of NKJPagerViewController and imprement dataSource and delegate methods in the subclass.

- (void)viewDidLoad
{
    self.dataSource = self;
    self.delegate = self;

    [super viewDidLoad];
}

NKJPagerViewDataSource

Decide number of tabs.

- (NSUInteger)numberOfTabView
{
    return 10;
}

Decide width for each tab.

- (NSInteger)widthOfTabView
{
    return 160;
}

Setting a view design for each tab.

- (UIView *)viewPager:(NKJPagerViewController *)viewPager viewForTabAtIndex:(NSUInteger)index
{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 160, 44)];
    label.backgroundColor = [UIColor grayColor];
    label.font = [UIFont systemFontOfSize:12.0];
    label.text = [NSString stringWithFormat:@"Tab #%lu", index * 10];
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor blackColor];

    return label;
}

Setting a view controller for each tab.

- (UIViewController *)viewPager:(NKJPagerViewController *)viewPager contentViewControllerForTabAtIndex:(NSUInteger)index
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    ContentViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"ContentViewController"];
    vc.textLabel = [NSString stringWithFormat:@"Content View #%lu", index];
    return vc;
}

NKJPagerViewDelegate

This method is option.

- (void)viewPager:(NKJPagerViewController *)viewPager didSwitchAtIndex:(NSInteger)index withTabs:(NSArray *)tabs
{
    // do something
}

Author

@nakajijapan

License

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

Latest podspec

{
    "name": "NKJPagerViewController",
    "version": "1.1.2",
    "summary": "NKJPagerViewController is like a PagerTabStrip, which is in Android. It contains an endlessly scrollable UIScrollView.",
    "homepage": "https://github.com/nakajijapan/NKJPagerViewController",
    "screenshots": "https://raw.githubusercontent.com/nakajijapan/NKJPagerViewController/master/swipe.gif",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "nakajijapan": "[email protected]"
    },
    "social_media_url": "https://twitter.com/nakajijapan",
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/nakajijapan/NKJPagerViewController.git",
        "tag": "1.1.2"
    },
    "source_files": "Classes/**/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This