Giter Site home page Giter Site logo

mohsinalimat / ios-viewpagerindicator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saiwu-bigkoo/ios-viewpagerindicator

1.0 2.0 0.0 108 KB

Paging indicator widgets,iOS版的分页指示器,可以配合UIScrollView使用完成分页控制

License: Apache License 2.0

Swift 97.22% Objective-C 2.78%

ios-viewpagerindicator's Introduction

iOS-ViewPagerIndicator

Paging indicator widgets,swift版的分页指示器,可以配合UIScrollView使用完成分页控制

Demo

//备注一下哦,如果在stroyboard里面拖控件,那么拖入一个UIView,设置class为ViewPagerIndicator之外,下面的module也要填写为ViewPagerIndicator哦

//样式设置
viewPagerIndicator.setTitleColorForState(UIColor.blackColor(), state: UIControlState.Selected)//选中文字的颜色
viewPagerIndicator.setTitleColorForState(UIColor.blackColor(), state: UIControlState.Normal)//正常文字颜色
viewPagerIndicator.tintColor = UIColor.brownColor()//指示器和基线的颜色
viewPagerIndicator.showBottomLine = false//基线是否显示
viewPagerIndicator.autoAdjustSelectionIndicatorWidth = true//指示器宽度是按照文字内容大小还是按照count数量平分屏幕
viewPagerIndicator.indicatorDirection = .Top//指示器位置
viewPagerIndicator.indicatorHeight = viewPagerIndicator.bounds.height//指示器高度
//点击viewPagerIndicator可以控制scrollView
//滑动scrollView可以改变viewPagerIndicator
//点击顶部选中后回调
    func indicatorChange(indicatorIndex: Int){
        scrollView.scrollRectToVisible(CGRectMake(self.view.bounds.width * CGFloat(indicatorIndex), 0, self.view.bounds.width, scrollViewHeight), animated: true)
    }
//滑动scrollview回调
    func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
        var xOffset: CGFloat = scrollView.contentOffset.x
        var x: Float = Float(xOffset)
        var width:Float = Float(self.view.bounds.width)
        let index = Int((x + (width * 0.5)) / width)
        viewPagerIndicator.setSelectedIndex(index)//改变顶部选中
    }

ios-viewpagerindicator's People

Contributors

saiwu-bigkoo avatar willzcc avatar

Stargazers

MohsinAli avatar

Watchers

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