iOS, Objective-C, UIButton, HighlightColor, Delay, Fading, Responsive, xCode
The CVResponsiveButton class provides the possibility to define a highlight color AND a fading time to get a "responsive" way of touching.
The code is licensed under the MIT License.
Written by Richard Jung [email protected].
Providing an example here:
https://github.com/Jusophos/CVResponsiveButtonExample
Some example screenshots & a video:
https://github.com/Jusophos/CVResponsiveButton/raw/master/screenshots/cvresponsivebutton_video.mp4
Include the following files to your xCode project:
- CVResponsiveButton.h
- CVResponsiveButton.m
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.
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];
// ...
You have two options
You can set the background color of highlighting state (on touch).
button.highlightBackgroundColor = [UIColor redColor];
You can set a fading time. It will be the "responsive" time after a touch (fading out). Value in seconds.
button.fadingTime = 0.7;