This article covers version 1.3.5

1.3.5 Integration provides the following functions

  • Indicator length is customized
  • Indicator cover style
  • Indicator fixed style
  • Indicator dynamic style
  • Indicator underline style
  • Multiple indicator scroll styles
  • Title button text fades in
  • Title button text zoom effect

Take a look at the directory structure

SGPageTitleViewConfigure belongs to SGPageTitleView configuration information, the reason for this design also benefits from WKWebView, WKWebView has its own configuration information; H header and sgPageTitlView. m, and put them in a configuration, and configure them before initializing SGPageTltleView. In this way, sgPageTitlView.h header will be more flexible than before and reduce the properties in sgPageTitlView.h header file, making sgPageTitlView.h look more clear, so a version update was made in 1.3.0

2. Two classes in SGPageContent are designed for two APP loading data modes respectively; The SGPageContentView internal view is wrapped with UICollectionView, and the SGPageContentScrollView internal view is wrapped with UIScrollView; GitHub problems and solutions for the two modes of data loading time to do the corresponding description and Issues also on SGPageContentView to do a little description, here is not introduced, interested can use the leisure time to understand ang

SGPagingView introduction

1. Indicator underline style

SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure]; configure.indicatorScrollStyle = SGIndicatorScrollStyleHalf; // Indicator scroll style, 3 kinds; TitleFont = [UIFont systemFontOfSize:12]; titleFont = [UIFont systemFontOfSize:12]; // Set the header number, The default 15 self. PageTitleView = [SGPageTitleView pageTitleViewWithFrame: frame delegate: self titleNames: titleNames configure:configure]; _pageTitleView.selectedIndex = 1; / / select the subscript _pageTitleView isTitleGradientEffect = NO; [self.view addSubview:_pageTitleView]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{// reset the title text content with the subscript [_pageTitleView resetTitleWithIndex:1 newTitle:@"The wait is over"];
});
Copy the code
2. Indicator cover style 1

    NSArray *titleArr = @[@"Select"The @"Film"The @"TV drama"The @"Variety"]; SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure]; configure.titleSelectedColor = [UIColor lightGrayColor]; configure.indicatorStyle = SGIndicatorStyleCover; configure.indicatorColor = [UIColor whiteColor]; configure.indicatorAdditionalWidth = 25; / / indicator for an additional length (headline width the width of the outside) configure. IndicatorBorderWidth = 1; / / indicator border width configure. IndicatorBorderColor = [UIColor lightGrayColor]; / / color indicator rounded configure indicatorCornerRadius = 20; / / indicator fillet size configure indicatorHeight = 25; /// pageTitleView self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:frame delegate:self titleNames:titleArr configure:configure]; [self.view addSubview:_pageTitleView];Copy the code
3, indicator cover style two

    NSArray *titleArr = @[@"Select"The @"Film"The @"OC"The @"Swift"]; SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure]; configure.titleSelectedColor = [UIColor whiteColor]; configure.indicatorStyle = SGIndicatorStyleCover; configure.indicatorColor = [UIColor blackColor]; configure.indicatorAdditionalWidth = 20; // Description: The additional width of the indicator, not set, the indicator width is the width of the header text; If set is infinite, the width of indicator is the configure button width. IndicatorCornerRadius = 30; / / description: In cover mode, the rounded corner of the indicator, if the rounded corner is greater than 1/2 of the indicator height, Indicator of the rounded as indicator 1/2 self. The height of pageTitleView = [SGPageTitleView pageTitleViewWithFrame: frame delegate: self titleNames: titleArr configure:configure]; _pageTitleView.isTitleGradientEffect = NO; [self.view addSubview:_pageTitleView];Copy the code
4, indicator cover style three

    NSArray *titleArr = @[@"Select"The @"Film"The @"TV drama"The @"Variety"The @"NBA"The @"Entertainment"The @"Anime"The @"Concert"The @"VIP"]; SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure]; configure.titleSelectedColor = [UIColor whiteColor]; configure.indicatorStyle = SGIndicatorStyleCover; configure.indicatorColor = [UIColor blackColor]; configure.indicatorAdditionalWidth = 100; // Description: The additional width of the indicator, not set, the indicator width is the width of the header text; If set is infinite, the width of indicator is the configure button width. IndicatorHeight = 122; // Description: No setting, the default height is text height + 5 under cover style; If I set it to infinity, Height as PageTitleView height / / / PageTitleView self. PageTitleView = [SGPageTitleView pageTitleViewWithFrame: frame delegate: self  titleNames:titleArr configure:configure]; [self.view addSubview:_pageTitleView];Copy the code
5, the indicator fixed length style

    NSArray *titleArr = @[@"Select"The @"New"The @"QQGroup"The @"429899752"];
    SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure];
    configure.indicatorStyle = SGIndicatorStyleFixed;
    
    self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:frame delegate:self titleNames:titleArr configure:configure];
    [self.view addSubview:_pageTitleView];
Copy the code
6. Indicator dynamic style

    NSArray *titleArr = @[@"Select"The @"Film"The @"TV drama"The @"Variety"The @"NBA"The @"Entertainment"The @"Anime"The @"Concert"The @"VIP"]; SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure]; configure.indicatorStyle = SGIndicatorStyleDynamic; Dynamic style / / configure. SpacingBetweenButtons = 35; // The spacing between headings, . The default is 20 f / / / pageTitleView self. PageTitleView = [SGPageTitleView pageTitleViewWithFrame: frame delegate: self titleNames:titleArr configure:configure]; [self.view addSubview:_pageTitleView];Copy the code
7. Scroll to finish loading content

    NSArray *titleArr = @[@"Select"The @"Film"The @"OC"The @"Swift"]; SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure]; configure.indicatorAdditionalWidth = 20; configure.indicatorScrollStyle = SGIndicatorScrollStyleEnd; / / indicator scroll mode / / / pageTitleView self. PageTitleView = [SGPageTitleView pageTitleViewWithFrame: frame delegate: self titleNames:titleArr configure:configure]; _pageTitleView.isTitleGradientEffect = NO; [self.view addSubview:_pageTitleView];Copy the code
8, text zoom style

9. Text fade in style

10. Finally, a small case is provided for reference only

What’s the difference between static style and scroll style?

The interior will automatically recognize the static or scroll style based on the text content of the title and the space between the buttons; The outside world doesn’t matter

For details, see Github Introduction

Making the address

P.S. If you like it, remember to give it a thumbs up