美文网首页
仿制网易新闻左右滑动页面切换效果

仿制网易新闻左右滑动页面切换效果

作者: 你猜我猜不猜你猜我猜不猜 | 来源:发表于2017-12-18 15:38 被阅读0次

DPPageViewController

git:https://github.com/DaoPinWong/DPPageViewController

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];


2017-02-15 15_58_51.gif

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;

More


    pagevc.itemHeight = 40;
    pagevc.minItemWidth = 70;
    pagevc.selectTitleZoomMultiple = 1.5;
    pagevc.commonColor = [UIColor blueColor];
    pagevc.selectColor = [UIColor redColor];
    
    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;
2017-02-15 16_32_29.gif

Author

dpwong, 413655409@qq.com

License

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

相关文章

网友评论

      本文标题:仿制网易新闻左右滑动页面切换效果

      本文链接:https://www.haomeiwen.com/subject/ptjmwxtx.html