Latest 0.1.4
Homepage https://github.com/ArchLL/HGSegmentedPageViewController
License MIT
Platforms ios 8.0, requires ARC
Dependencies Masonry
Authors

License MIT
Platform
Pod version

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 8.0+
  • Objective-C
  • Xcode 9+

Installation

HGSegmentedPageViewController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'HGSegmentedPageViewController', '~> 0.1.4'

Blog

简书

image

Usage

Example: HGSegmentedPageViewController / Example


#import "HGSegmentedPageViewController.h"

@interface HGViewController ()
@property (nonatomic, strong) HGSegmentedPageViewController *segmentedPageViewController;

@end

- (void)viewDidLoad {
    [super viewDidLoad];

    [self addChildViewController:self.segmentedPageViewController];
    [self.view addSubview:self.segmentedPageViewController.view];
    [self.segmentedPageViewController didMoveToParentViewController:self];
    [self.segmentedPageViewController.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
}

/*
*设置segmentedPageViewController的categoryView以及pageViewControllers
*这里可以对categoryView进行自定义,包括分布方式(左、中、右)、高度、背景颜色、字体颜色、字体大小、下划线高度和颜色等
*/
- (HGSegmentedPageViewController *)segmentedPageViewController {
    if (!_segmentedPageViewController) {
        NSMutableArray *controllers = [NSMutableArray array];
        NSArray *titles = @[@"华盛顿", @"夏威夷", @"拉斯维加斯", @"纽约", @"西雅图", @"底特律", @"费城", @"旧金山", @"芝加哥"];
        for (int i = 0; i < titles.count; i++) {
            UIViewController *controller;
            if (i % 3 == 0) {
                controller = [[HGThirdViewController alloc] init];
            } else if (i % 2 == 0) {
                controller = [[HGSecondViewController alloc] init];
            } else {
                controller = [[HGFirstViewController alloc] init];
            }
            [controllers addObject:controller];
        }
        _segmentedPageViewController = [[HGSegmentedPageViewController alloc] init];
        _segmentedPageViewController.pageViewControllers = controllers;
        _segmentedPageViewController.categoryView.titles = titles;
        _segmentedPageViewController.categoryView.alignment = HGCategoryViewAlignmentLeft;
        _segmentedPageViewController.categoryView.originalIndex = 0;
        _segmentedPageViewController.categoryView.itemSpacing = 25;
        _segmentedPageViewController.categoryView.backgroundColor = [UIColor yellowColor];
        _segmentedPageViewController.categoryView.topBorder.hidden = YES;
    }
    return _segmentedPageViewController;
}

Author

Arch, [email protected]

License

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

Latest podspec

{
    "name": "HGSegmentedPageViewController",
    "version": "0.1.4",
    "license": "MIT",
    "summary": "A paging solution",
    "description": "A paging solution.nHGSegmentedPageViewController supports iOS.",
    "homepage": "https://github.com/ArchLL/HGSegmentedPageViewController",
    "authors": {
        "Arch": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ArchLL/HGSegmentedPageViewController.git",
        "tag": "0.1.4"
    },
    "source_files": "HGSegmentedPageViewController/Classes/*.{h,m}",
    "ios": {
        "frameworks": [
            "Foundation",
            "UIKit"
        ]
    },
    "platforms": {
        "ios": "8.0"
    },
    "dependencies": {
        "Masonry": [
            "~> 1.1.0"
        ]
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This