TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Apr 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Marcos Palacios.
Have you ever tried to edit the constraints of the elements inside a UIButton? Adding new elements without breaking existing layout? Just make the touchable area bigger?
MPButton
is a lightweight class that decorates any UIView
adding UIControlEvents
(ie. touchUpInside) and customizable touching area. This way, you only need to care about the UI.
As easy as this:
let button = MPButton(decoratedView: MyView(), hitbox: CGSize(width: 250, height: 90))
button.addTarget(self, action: #selector(self.doSomething), for: .touchUpInside)
button.decoratedView.myViewLabel.text = "No need to cast"
To run the example project, clone the repo, and run pod install
from the Example directory first.
MPButton is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MPButton"
btadine
MPButton is available under the MIT license. See the LICENSE file for more info.