GithubHelp home page GithubHelp logo

imclab / tltiltslider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from teehanlax/tltiltslider

0.0 2.0 0.0 60 KB

A UISlider subclass which adjusts its appearance based on the positional attitude of an iOS device.

License: MIT License

tltiltslider's Introduction

TLTiltSlider

TLTiltSlider is a UISlider subclass with an angular gradient for a Thumb image which adjusts its appearance based on the positional attitude of the device. The movement of the gradient when re-orientating the device is subtle. This mimics the iOS 6 Music app (notice the gradient on the sliders).

This class demonstrates how to use the Core Motion framework to adjust to device attitude changes. Rendering angular gradients is complex and it may affect your application's responsiveness on older devices. Always make sure to test your application on an actual device.

One angular gradient Another angular gradient

How to Use

Drag TLTiltSlider.h and TLTiltSlider.m, as well as the images in the Resources directory, into your project. Make sure to link against the Core Motion framework.

Alternatively, you can use CocoaPods:

pod search TLTiltSlider

Create an instance of TLTiltSlider and add it to a view hierarchy. The UISlider superclass will centre itself vertically within the view; optimal sizes are 23pt or greater.

TLTiltHighlightView *slider = [[TLTiltSlider alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 23)];
[self.view addSubview:slider];

Slider

Alternatively to instantiating the class programmatically, you can also use Interface Builder by selecting the Identity Inspector and changing the class of a view.

Identity Inspector

You can also disable the tilt updates for older devices:

slider.tiltEnabled = NO;

Requirements

You must link with Core Motion. This project requires ARC.

tltiltslider's People

Contributors

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