DPPageViewController 1.0.6

DPPageViewController 1.0.6

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Aug 2021

Maintained by wang.



  • By
  • dpwong

DPPageViewController

CI Status Version License Platform

Example

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

Requirements

Installation

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

pod "DPPageViewController"

Usage

Quick to use

#import "DPPageViewController.h"


DPPageViewController *pagevc = [[DPPageViewController alloc] initWithTitle:@"Page View Controller" viewControllers:@[vc1,vc2,vc3,vc4,vc5]];
[self.navigationController pushViewController:pagevc animated:YES];

Property

/// 中间的view使用时直接赋值
@property (nonatomic, strong) UIView *middleView;

/// 底部的view使用时直接赋值
@property (nonatomic, strong) UIView *bottomView;

/// 当前页的索引
@property (nonatomic, assign) NSInteger displayIndex;

/// 当前显示的view
@property (nonatomic, strong) UIView *displayView;

@property (nonatomic, copy, readonly) NSArray *viewControllers;

/// 普通的颜色
@property (nonatomic, strong) UIColor *commonColor;

/// 选中的颜色
@property (nonatomic, strong) UIColor *selectColor;

/// title字体大小
@property (nonatomic, assign) CGFloat titleSize;

/// 选中的title放大倍数 (默认1@property (nonatomic, assign) CGFloat selectTitleZoomMultiple;

Delegate

@protocol DPPageViewControllerDelegate <NSObject>

@optional

- (void)pageViewController:(DPPageViewController *)pageViewController displayIndex:(NSInteger)index;

/**
 自定义小title
 */
- (void)pageViewController:(DPPageViewController *)pageViewController titleItem:(UIButton *)item;


@end

More

	// move TopView
    vc1.pageViewController = pagevc;
    vc2.pageViewController = pagevc;


    pagevc.itemHeight = 40;
    pagevc.minItemWidth = 70;
    pagevc.selectTitleZoomMultiple = 1.5;
    pagevc.commonColor = [UIColor blueColor];
    pagevc.selectColor = [UIColor redColor];
    

    UIView *topView = [UIView new];
    topView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 250);
    UILabel *topLabel = [UILabel new];
    topLabel.textAlignment = NSTextAlignmentCenter;
    topLabel.text = @"Top View";
    [topView addSubview:topLabel];
    topLabel.frame = topView.bounds;
    pagevc.topView = topView;


    UIView *middleView = [UIView new];
    middleView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 50);
    UILabel *middleLabel = [UILabel new];
    middleLabel.textAlignment = NSTextAlignmentCenter;
    middleLabel.text = @"Middle View";
    [middleView addSubview:middleLabel];
    middleLabel.frame = middleView.bounds;
    pagevc.middleView = middleView;
    
    
    UIView *bottomView = [UIView new];
    bottomView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 50);
    UILabel *bottomLabel = [UILabel new];
    bottomLabel.textAlignment = NSTextAlignmentCenter;
    bottomLabel.text = @"Bottom View";
    [bottomView addSubview:bottomLabel];
    bottomLabel.frame = bottomView.bounds;
    pagevc.bottomView = bottomView;

Author

dpwong, [email protected]

License

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