Latest 1.0.4
Homepage https://github.com/JiachengZheng/JCPageController
License MIT
Platforms ios 7.0, requires ARC
Authors

page scroll View controller 水平滚动页面控制器

CocoaPods

pod 'JCPageController'

ScreenShot

JCPageController

DataSource and Delegate

@protocol JCPageContollerDataSource <NSObject>

@required
// return number of subControllers
- (NSInteger)numberOfControllersInPageController;

// return each viewController
- (UIViewController *)pageContoller:(JCPageContoller *)pageContoller controllerAtIndex:(NSInteger)index;

// return each bar width
- (CGFloat)pageContoller:(JCPageContoller *)pageContoller widthForCellAtIndex:(NSInteger)index;

// return each controller reuse identifier
- (NSString *)reuseIdentifierForControllerAtIndex:(NSInteger)index;

@optional
// return each bar title
- (NSString *)pageContoller:(JCPageContoller *)pageContoller titleForCellAtIndex:(NSInteger)index;

@optional

@end

@protocol JCPageContollerDelegate <NSObject>

@optional
- (void)pageContoller:(JCPageContoller *)pageContoller didShowController:(UIViewController *)controller atIndex:(NSInteger)index;

@end

Demo

- (JCPageContoller *)pageController{
    if (!_pageController) {
        _pageController = [[JCPageContoller alloc]init];
        _pageController.delegate = self;
        _pageController.lineAinimationType = self.lineAinimationType;
        _pageController.dataSource = self;
        _pageController.scaleSelectedBar = self.scaleSelectedBar;
        [self addChildViewController:_pageController];
        [self.view addSubview:_pageController.view];
    }
    return _pageController;
}

- (NSInteger)numberOfControllersInPageController{
    return count;
}

- (NSString *)reuseIdentifierForControllerAtIndex:(NSInteger)index;{
    return identifier;
}

- (UIViewController *)pageContoller:(JCPageContoller *)pageContoller controllerAtIndex:(NSInteger)index{
    UIViewController *controller = [pageContoller dequeueReusableControllerWithReuseIdentifier:identifier atIndex:index];
    if (!controller) {
        //controller init
    }
    return controller;
}

- (CGFloat)pageContoller:(JCPageContoller *)pageContoller widthForCellAtIndex:(NSInteger )index{
    return width;
}

- (NSString *)pageContoller:(JCPageContoller *)pageContoller titleForCellAtIndex:(NSInteger)index{
    return text;
}

更多请查看Demo

About Me

QQ:1083841067

Email:[email protected]

如果你发现bug,please pull reqeust me

如果你有更好的改进,please pull reqeust me

Latest podspec

{
    "name": "JCPageController",
    "version": "1.0.4",
    "summary": "JCPageController",
    "homepage": "https://github.com/JiachengZheng/JCPageController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "zhengjiacheng": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/JiachengZheng/JCPageController.git",
        "tag": "1.0.4"
    },
    "source_files": "JCPageController/**/*.{h,m}",
    "public_header_files": "JCPageController/**/*.h",
    "requires_arc": true
}

Pin It on Pinterest

Share This