The idea for this framework came from an observation from Max Rudberg. This framework seeks to make his suggestion of buttons in iOS having a “push down state” easier for developers to bring into their own projects.
- iOS 8.0+
- Xcode 8.1+
- Swift 3.0+
To add PushDownState to your Xcode project using Carthage, specify it in your Cartfile
:
github "nateansel/PushDownState"
Run carthage update
to build the framework and drag the built PushDownState.framework
into your Xcode project.
To use PushDownState in any file of your project, first
import PushDownState
To add a push down state to UIButtons, UITableViewCells, and UICollectionViewCells, simply subclass either PushDownButton
, PushDownTableViewCell
, or PushDownCollectionViewCell
. A push down state will automatically be added to the UI element.
To fine tune the push down state for buttons or cells, simply edit the four values that you have access to. These values are all @IBInspectable
, so they can be changed in your storyboard or xib files.
Currently, you can edit:
var pushDownDuration: TimeInterval
var pushDownScale: CGFloat
var pushDownRoundCorners: Bool
var pushDownBackgroundColor: UIColor?
- Add background color manipulation
- Add support for additional changes in the push down state
PushDownState is released under the MIT license. See LICENSE for details.