Coder Social home page Coder Social logo

sttimeslider's Introduction

Build Status

STTimeSlider

A custom component like UISegmentedControl highly customizable.

STTimeSlider screenshot

Documentation

Installation

You can use CocoaPods by adding STTimeSlider in your Podfile. If you don't want to use this method, please refer to the following method:

Please include these 4 files:

  • STTimeSlider.h
  • STTimeSlider.m
  • STTimeSliderModeView.h
  • STTimeSliderModeView.m

And include QuartzCore.framework and CoreGraphics.framework.

This plugin is highly customizable. You can customize:

STTimeSlider doc sizes

Mode

  • STTimeSliderMode mode: The mode of the slider (multi points or solo)
  • int startIndex: In mode STTimeSliderModeMulti, it's the initial departure point

Basic

  • float numberOfPoints: The number of points (more than 1)
  • float radiusPoint: (1) The radius of the point
  • float heightLine: (2) The height of the line between two points. The height must be lower than radiusPoint * 2;
  • float spaceBetweenPoints: (3) The space between two points
  • float radiusCircle: (4) The radius of the point inside the selected circles

Gradient

  • CGGradientRef gradient: The gradient of the background bar
  • CGGradientRef gradientForeground: The gradient of the foreground bar

Stroke

  • UIColor *strokeColor: The color of the background bar's stroke.
  • float strokeSize: The size of the background bar's stroke.
  • UIColor *strokeColorForeground: The color of the foreground bar's stroke.
  • float strokeSizeForeground: The size of the foreground bar's stroke.

Shadow

  • CGSize shadowSize: The size.
  • float shadowBlur: The blur.
  • UIColor *shadowColor: The color.

Demo

Build and run the project STTimeSliderExample in Xcode to see STTimeSlider in action.

Example Usage

    STTimeSlider *timeSlider = [[STTimeSlider alloc] initWithFrame:CGRectMake(5.0, 5.0, 310.0, 110.0)];
    [timeSlider setDelegate:self];
    [self.view addSubview:timeSlider];

Don't forget to implementSTTimeSliderDelegate protocol in your ViewController. Without it, you won't be able to detect when the user will change the index:

    - (void)timeSlider:(STTimeSlider *)timeSlider didSelectPointAtIndex:(int)index {
        NSLog(@"User clicked on TimeSlider %@ at Index %d", timeSlider, index);
    }

or when the slider has changed:

    - (void)timeSlider:(STTimeSlider *)timeSlider didMoveToPointAtIndex:(int)index {
        NSLog(@"TimeSlider %@ has changed at Index %d", timeSlider, index);
    }

You can change the index of the slider with - (void)moveToIndex:(int)index;.

Contact

Sebastien Thiebaud

License

STTimeSlider is available under the MIT license.

sttimeslider's People

Contributors

akhrameev avatar honood avatar

Watchers

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