CDDPagerController 1.1.7

CDDPagerController 1.1.7

测试已测试
语言语言 Obj-CObjective C
许可证 Apache-2.0
发布最后发布Aug 2020

RocketsChen维护。



  • 作者
  • RcoketsChen

CDDPagerController

一个非常实用的父子控制器小型框架。

语言

CocoaPods CocoaPods 

需求

  • Xcode 8+

用法

  • 你可以这样做。
#pragma mark - LazyLoad
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
//    self.selectIndex = 3; //default option
}

#pragma mark - LifeCyle
- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [self setUpAllChildViewController];
    
    [self setUpDisplayStyle:^(UIColor *__autoreleasing *titleScrollViewBgColor, UIColor *__autoreleasing *norColor, UIColor *__autoreleasing *selColor, UIColor *__autoreleasing *proColor, UIFont *__autoreleasing *titleFont, CGFloat *titleButtonWidth, BOOL *isShowPregressView, BOOL *isOpenStretch, BOOL *isOpenShade) {
        *titleScrollViewBgColor = [UIColor whiteColor]; //View background color
        *norColor = [UIColor darkGrayColor];            //Unselected color (the font color is black by default)
        *selColor = [UIColor orangeColor];              //Highlight the color (the font color is red by default)
        *proColor = [UIColor purpleColor];              //Scrollbar color (by default the color of the title is selected)
        *titleFont = [UIFont systemFontOfSize:16];      //FontSize (default fontSize is 15)
        
        *titleButtonWidth = 100;                        //Width of the title button (with default)
        
        /*
         The following BOOL values are NO.
         */
        *isShowPregressView = YES;                      //Whether to open the lower Pregress indicator under the heading.器
        *isOpenStretch = YES;                           //Whether to open indicator stretch effect.
        *isOpenShade = YES;                             //whether to open the font gradient.
    }];
    
    
    
//    [self setUpTitleScale:^(CGFloat *titleScale) { //The titleScale range is between 0 and 1 <0 or > 1, and the default is not resized by default. TitleScale opens the zoom, and the default is closed.
//        *titleScale = 0.1;
//    }];
//
//    [self setUpProgressAttribute:^(CGFloat *progressLength, CGFloat *progressHeight, CGFloat *bottomDistance) {//ProgressLength sets the length of the bottom progress indicator, with the default value of 56 progressHeight default height of the button's width (and no greater than 10)
//        *progressLength = 40;
//        *progressHeight = 5;
//    }];
    
//    [self setUpTopTitleViewAttribute:^(CGFloat *topDistance, CGFloat *titleViewHeight) {
//        *topDistance = 200;
//    }];
}

#pragma mark - Add all childControllers.
- (void)setUpAllChildViewController
{
    NSArray *titles = @[@"text01",@"text02",@"text03",@"text04",@"text05"];
    for (NSInteger i = 0; i < titles.count; i++) {
        UIViewController *vc = [UIViewController new];
        vc.title = titles[i];
        vc.view.backgroundColor = RandColor; //Random color
        [self addChildViewController:vc];
    }
}


#pragma mark - Child pages change individually
- (void)setUpAllChildViewController
{
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ //模拟网络延迟
        UIViewController *vc = self.childViewControllers.firstObject;
        vc.title = @"我要变了";
        [self setUpRefreshDisplay]; //刷新
    });
}

版本更新

版本 备注
1.1.0 开始 ~🤔
1.1.1 新增:生命周期更新。
1.1.6 新增:子页面可单独更改。
1.1.7 修复:跳转回问题。

##安装

手动

  • 将扩展文件夹下的所有源文件(CDDPagerController)拖拽到您的项目中。
  • 在AppDelegate中导入头文件(DCPageKit.h)。
  • 调用一个方法

CocoaPods

  • 使用CocoaPods安装:pod CDDPagerController

Swift版本

  • 开发中等待

协议

  • CDDPagerController 使用MIT许可证授权。有关更多信息,请参阅LICENSE