Giter VIP home page Giter VIP logo

xhpagecontrol's Introduction

XHPageControl

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Summary

The latest version: 0.1.0

A concise and user-friendly custom UIPageControl

Please refer to the Swift version:Swift版本:JJPageControl

Requirements

  >= iOS 10.0

Installation

XHPageControl is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'XHPageControl'

Use

将自定义PageControl类拖到项目中,并导入头文件.

//创建pageControl
XHPageControl  *pageControl = [[XHPageControl alloc] initWithFrame:CGRectMake(0, 300,[UIScreen mainScreen].bounds.size.width, 30)];
//设置点的总个数
pageControl.numberOfPages = 7;
//设置非选中点的大小(宽度和高度)
pageControl.otherPointSize = CGSizeMake(12, 6);
//设置选中点的大小(宽度和高度)
pageControl.currentPointSize = CGSizeMake(24, 6);
//设置圆角大小
pageControl.pointCornerRadius = 3;
//设置两点之间的间隙
pageControl.controlSpacing = 3;
//左右间宽,只有在居左居右显示的时候才有用
pageControl.leftAndRightSpacing = 10;
//设置样式.默认居中显示
pageControl.pageAliment = PageControlMiddle;
//非选中点的颜色  
pageControl.otherColor=[UIColor grayColor];
//选中点的颜色  
pageControl.currentColor=[UIColor orangeColor];
//当只有一个点的时候是否隐藏,默认隐藏
pageControl. isHidesForSinglePage = YES;
//是否可以点击,默认不可以点击
pageControl .isCanClickPoint = YES;
//代理    
pageControl.delegate = self;
//标记    
pageControl.tag = 902;
    
[self.view addSubview:pageControl];

代理实现:

#pragma mark - 代理
- (void)xh_PageControlClick:(XHPageControl*)pageControl index:(NSInteger)clickIndex{

    NSLog(@"%ld",clickIndex);
    if(pageControl.tag == 902){
        CGPoint position = CGPointMake([UIScreen mainScreen].bounds.size.width * clickIndex, 0);
        [_scrollView2 setContentOffset:position animated:YES];
    }
}


Author

zhouxuanhe, [email protected]

License

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

xhpagecontrol's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.