Skip to content

inaka/FadeButton

Repository files navigation

FadeButton

Fading effects for UIButtons made simple

Build Status Swift Cocoapods Twitter

Overview

This is just a customizable UIButton subclass that provides fading effects that display upon touch:

Sample

Effects occur when the user releases the button.

Usage

1) Go to interface builder, select your button, open the Identity Inspector tab, and set FadeButton as custom class.

Sample

2) Check out the following attributes in the Attributes Inspector tab:

Sample

  • fadeDuration configures how long the fading effect will last.
  • Then, the properties textColor, image and backgroundImage (that can have different values set for each state config) will be affected by the fading effect when the transitions between the .highlighted state and the .normal state occur.
    • For instance, if you set textColor: .white for: .normal state and textColor: .yellow for: .highlighted state, the user will see a fading text effect from yellow to white after releasing the button.

Sample Project

There's a sample project inside this repo that you can check out in order to have a deeper understanding of the usage of this library.

Setup

  • Via cocoapods, add this line to your Podfile:
    • pod 'FadeButton', '~> 2.0'
  • Otherwise, you can just drag and drop the FadeButton.swift file into your project, and keep it up to date by yourself.

Older Versions Support

  • As of its 2.0.0 release, this library works with Swift 3.0
  • If you look for older languages version support, you can check out the 1.0.0 release, that contains the old Objective-C version of the library, which is compatible with older Swift versions.

Contact Us

For questions or general comments regarding the use of this library, please use our public hipchat room.

If you find any bug, a problem while using this library, or have suggestions that can make it better, please open an issue in this repo (or a pull request).

You can also check all of our open-source projects at inaka.github.io.