GithubHelp home page GithubHelp logo

jusophos / cvresponsivebutton Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 1.15 MB

A iOS subclass of UIButton to provide the possibility to set a highlight background color on touch. Responsive fading feature included.

Objective-C 100.00%

cvresponsivebutton's Introduction

CVResponsiveButton

Tags

iOS, Objective-C, UIButton, HighlightColor, Delay, Fading, Responsive, xCode

Overview

The CVResponsiveButton class provides the possibility to define a highlight color AND a fading time to get a "responsive" way of touching.

License

The code is licensed under the MIT License.

Copyright

Written by Richard Jung [email protected].

Example

Providing an example here:

https://github.com/Jusophos/CVResponsiveButtonExample

Some example screenshots & a video:

Sample 1 Sample 2

https://github.com/Jusophos/CVResponsiveButton/raw/master/screenshots/cvresponsivebutton_video.mp4

Installation

Include the following files to your xCode project:

  • CVResponsiveButton.h
  • CVResponsiveButton.m

Usage

You can use the CVResponsiveButton class like the UIButton class, because it is a subclass. As example drag an UIButton instance to interface builder and apply the CVResponsiveButton class.

Sample 3

or create it manually

#import "CVResponsiveButton.h"

// ...

CVResponsiveButton *button = [[CVResponsiveButton alloc] initWithFrame:CGRectMake(10, 10, 70, 70)];
button.highlightBackgroundColor = [UIColor redColor];
[button setTitle:@"Test" forState:UIControlStateNormal];

// ...

Options

You have two options

HighlightBackgroundColor

You can set the background color of highlighting state (on touch).

button.highlightBackgroundColor = [UIColor redColor];

FadingTime

You can set a fading time. It will be the "responsive" time after a touch (fading out). Value in seconds.

button.fadingTime = 0.7;

cvresponsivebutton's People

Contributors

jusophos avatar

Stargazers

 avatar Martin Man avatar TH avatar SuperFancy avatar  avatar Sebastian Roth avatar

Watchers

 avatar James Cloos avatar Mustafa Kamal Ismail Ahmed 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.