Giter Site home page Giter Site logo

hyb1234hi / uiindicatorview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kesionx/uiindicatorview

0.0 1.0 0.0 8.77 MB

可用于viewpage索引指标控件(This is an index indicator for the UIViewpage and so on)

License: Apache License 2.0

Objective-C 96.97% Ruby 3.03%

uiindicatorview's Introduction

UIIndicatorView

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

This is an index indicator for the UIViewpage.

pod install

you can user pod install into your project. as following

target 'Pro' do
pod 'UIIndicatorView'
end

使用

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

Can be used index indicator, you can refer to the following usage.

例一

eg:

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

例二

eg:

{
    [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中加下面的代码

If you want to animate, you need to listen to the UIScrollerView and add the following code to the delegate.

#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
   [self.indicatorView changeIndicatorIndexByScrollerView:scrollView];
}

如果你想监听当前索引的点击事件,可以使用UIIndicatorView的代理.

If you want to listen for index indicator click action, you can use the proxy for UIIndicatorView. as following

@protocol UIIndicatorViewDelegate <NSObject>

@optional
- (void) indicatorItemsClick:(NSUInteger)index;

@end
@interface ViewController () <UIIndicatorViewDelegate>

@end
- (void)viewDidLoad 
{
   self.indicatorView.indicatorDelegate = self;
}

uiindicatorview's People

Contributors

kesionx avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.