Giter Site home page Giter Site logo

tapagecontrol's Introduction

About TAPageControl

TAPageControl basically is a more powerfull UIPageControl. It offers you greater flexibility and customization.

demo

How it works

It works like a basic UIPageControl but with more options and properties so it can fit your needs. It comes with a default dot view, but you can easily replace it by any UIView object that you want (more on that later) or with any image.

The only required property to set to get it working, like UIPageControl, is a number of pages :

self.pageControl.numberOfPages = 9;

Installation

CocoaPods

With CocoaPods by adding in your podfile the following line :

pod 'TAPageControl'

Manually

It's quite easy, just download the archive and add the TAPageControl folder to your own project. Don't forget to import the header file wherever you need it :

#import "TAPageControl.h"

Customization's magic

If you are looking for a page control I guess it's because the default one provided by Apple did not answer your need. Then you are looking for a page control that you can customize at will and you are at the right place!

TAPageControl uses two kind of source to display "dots" representing pages :

  • UIImage
  • UIView

UIImage is the simplest way to make your page control look the way you want. There are two properties :

/**
 *  UIImage to represent a dot.
 */
@property (nonatomic) UIImage *dotImage;

/**
 *  UIImage to represent current page dot.
 */
@property (nonatomic) UIImage *currentDotImage;

By setting both properties with your images, the control will take care of displaying the correct version depending on the current page.

But what if you need more control? Well, will a UIView be enough for you? By using :

/**
 *  The Class of your custom UIView, make sure to respect the TAAbstractDotView class.
 */
@property (nonatomic) Class dotViewClass;

The control will instantiate your UIView class as a dot. I recommend subclassing your view with TAAbstractDotView because the only important thing to respect is the method to switch your view between active/inactive state.

@interface TAAbstractDotView : UIView

/**
 *  A method call let view know which state appearance it should take. Active meaning it's current page. Inactive not the current page.
 *
 *  @param active BOOL to tell if view is active or not
 */
- (void)changeActivityState:(BOOL)active;

There you go, you can do whatever you want with it. Shape, color, animations... everything.

Take a look at the sample project to see how great and simple it is by yourself ;)

License

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

More

Contribute to this repository as much as you like, and any advice are welcome! =). I hope you will enjoy it.

tapagecontrol's People

Contributors

tanguyaladenise avatar

Watchers

 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.