JHPageViewController 0.2.3

JHPageViewController 0.2.3

Maintained by jackiehu.



  • By
  • HU

JHPageViewController

抄袭自ASPageViewController 添加底部线设置长短的方法,对UIPageViewController的简单封装

##属性

//顶部View两边的空间,比如你使用模态进入的时候,可以空出一段距离设置返回按钮等
@property (nonatomic, assign) CGFloat sideBothWidth;
/**
 *  给一个数组用来设置各个item的宽度
 */
@property(nonatomic, strong) NSArray *itemWidthArray;
/**
 *  一键设置item的宽度
 */
@property (nonatomic, assign) CGFloat itemWidth;
//下划线宽度
@property (nonatomic, assign) CGFloat lineWidth;

//设置顶部试图的style
@property (nonatomic, assign) JHTopViewStyle style;

//设置每一个Item的字体名字
@property (nonatomic, copy) NSString *titleName;
//下划线的颜色
@property (nonatomic, strong) UIColor *lineColor;

//非选中的时候的字体大小
@property (nonatomic, assign) CGFloat normalSize;
//选中的字体大小
@property (nonatomic, assign) CGFloat selectedSize;
//非选中状态的字体颜色
@property (nonatomic, strong) UIColor *normalTitleColor;
//选中状态的字体颜色
@property (nonatomic, strong) UIColor *selectTitleColor;
//上部View的背景色
@property (nonatomic, strong) UIColor *topViewBackGroundColor;

##API

-(id)initWithViewControllerClasses:(NSArray<Class> *)classes andTitles:(NSArray <NSString *> *)titles;

使用方法

可以直接使用JHPageViewController也可以继承JHPageViewController,自己内部可配置背景导航等等

    JHPageViewController *vc = [[JHPageViewController alloc] initWithViewControllerClasses:@[[TestPageViewController class],[TestPageViewController class]] andTitles:@[@"1111",@"2222"]];
    //设置每一个item的宽度
    vc.itemWidth = 120;
    vc.lineWidth = 50;
    //设置样式(有下划线)
    vc.style = JHTopViewStyleLine;
    
    [self.navigationController pushViewController:vc animated:YES];

安装

1.手动添加:

  • 1.将 JHPageViewController 文件夹添加到工程目录中
  • 2.导入 JHPageViewController.h

2.CocoaPods:

  • 1.在 Podfile 中添加 pod 'JHPageViewController'
  • 2.执行 pod install 或 pod update
  • 3.导入 JHPageViewController.h