UIViewPage 指示器 仿简书

https://github.com/Kesion-X/UIIndicatorView

UIIndicatorView

这是一个用于viewpage的一个索引指示器

pod install


target 'Pro' do

pod 'UIIndicatorView'

end

使用

可用于viewpage索引指标控件,可以参考下以下用法

例一


    UIIndicatorView *indicator = [[UIIndicatorView alloc] initUIIndicatorViewWithFrame:CGRectMake(10, 20, [UIScreen mainScreen].bounds.size.width - 40, 100) style:UIIndicatorViewDefaultStyle arrays:@[@"KESION", @"WENDYTING", @"TIPO", @"BLOW", @"SUCCESS"]];

    [self.view addSubview:indicator];





    UIIndicatorView *indicator2 = [[UIIndicatorView alloc] initUIIndicatorViewWithFrame:CGRectMake(10, 150, [UIScreen mainScreen].bounds.size.width - 40, 100) style:UIIndicatorViewLineStyle arrays:@[@"KESION", @"WENDYTING", @"TIPO", @"BLOW", @"SUCCESS"]];

    [self.view addSubview:indicator2];

[图片上传失败...(image-2836a7-1526497013863)]


IMG_3443.GIF

例二


{

    [self.indicatorView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(self.addNewAttention.mas_bottom).offset(4);

        make.left.equalTo(self).offset(8);

        make.right.equalTo(self).offset(-8);

        make.height.mas_equalTo([self.indicatorView getUIHeight]);

    }];

    [_indicatorView addIndicatorItemByString:@"Tube最新内容"];

    [_indicatorView addIndicatorItemByString:@"推荐"];

    [_indicatorView addIndicatorItemByString:@"关注专题"];

    [_indicatorView addIndicatorItemByString:@"关注连载"];

    [_indicatorView addIndicatorItemByString:@"关注作者"];

    [self.indicatorView setShowIndicatorItem:0];

}

- (UIIndicatorView *)indicatorView

{

    if (!_indicatorView) {

        _indicatorView = [[UIIndicatorView alloc] initUIIndicatorViewWithIndicatorColor:kTUBEBOOK_THEME_NORMAL_COLOR font:Font(12)];

    }

    return _indicatorView;

}

如果你想有动画效果那么需要对UIScrollerView进行监听,且在delegate中加下面的代码


#pragma mark - UIScrollViewDelegate

- (void)scrollViewDidScroll:(UIScrollView *)scrollView

{

  [self.tubeNavigationView.indicatorView changeIndicatorIndexByScrollerView:scrollView];

}

[图片上传失败...(image-cbaac9-1526497013863)]


image2.gif
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容