aloco / simplebutton Goto Github PK
View Code? Open in Web Editor NEWSimple UIButton subclass with additional state change animations (e.g. backgroundColor) and missing features
License: MIT License
Simple UIButton subclass with additional state change animations (e.g. backgroundColor) and missing features
License: MIT License
Following semantic versioning I think we can safely release version 3.0 for Swift 2.3.
The button doesn't appear as expected when subclassed and used with @IBInspectable
variables to set up the values for configureButtonStyles
like here:
import UIKit
import SimpleButton
@IBDesignable
class DesignableButton: SimpleButton {
/// Background color for normal state.
@IBInspectable var backgroundColorNormal: UIColor?
@IBInspectable var backgroundColorHighlight: UIColor?
@IBInspectable var titleColorNormal: UIColor?
@IBInspectable var titleColorHighlighted: UIColor?
@IBInspectable var shadow: Bool = false
@IBInspectable var shadowColor: UIColor?
@IBInspectable var shadowOffset: CGSize = CGSizeZero
@IBInspectable var shadowRadius: CGFloat = 0
@IBInspectable var shadowOpacity: Float = 0
override func configureButtonStyles() {
super.configureButtonStyles()
if let backgroundColorNormal = backgroundColorNormal {
setBackgroundColor(backgroundColorNormal, forState: .Normal)
}
if let backgroundColorHighlight = backgroundColorHighlight {
setBackgroundColor(backgroundColorHighlight, forState: .Highlighted)
}
if let titleColorNormal = titleColorNormal {
setTitleColor(titleColorNormal, forState: .Normal)
}
if let titleColorHighlighted = titleColorHighlighted {
setTitleColor(titleColorHighlighted, forState: .Highlighted)
}
if shadow {
if let shadowColor = shadowColor {
setShadowColor(shadowColor)
}
setShadowOffset(shadowOffset)
setShadowRadius(shadowRadius)
setShadowOpacity(shadowOpacity)
}
}
}
will you please make this package for CocoaPods.
thanks
Hello,
In non autolayout view button's position is set to zero and size is minimized, removing this line of code fixes issue
Why do you have this? Can I break anything by removing it?
Cocoapods still references the old 2.1.1 version, rather than the latest (v3 as of writing this).
It would be much appreciated if this could be updated. For now I'll just change my Podfile to point at the latest tag.
https://cocoapods.org/?q=simplebutton
P.S. Thank you for this excellent Pod :)
At present, the control completely blows VaryForTrait away. I think it is moderately easy to enable, but will have to review the Apple vids to confirm. This makes the corner radius attribute useless for a properly proportioned multi-device app.
If time permits, i will see if I can make it aware, then post back here, else (due to time constraints) will just tweak my deliverable to miss the mark as minimally as i can.
Cocoapods(https://cocoapods.org/pods/SimpleButton) still references the old 4.0.1 version, rather than the latest (5.0).
It would be much appreciated if this could be updated.
Thank you so much!
I get this error.
Specs satisfying the `SimpleButton (~> 2.1)` dependency were found, but they required a higher minimum deployment target.
Please release a new version with the latest changes.
You can reproduce this by adding the following line to the sample project:
let awesomeButton = SimpleButton.buttonWithType(.Custom) as! SimpleButton
awesomeButton.enabled = false //add this
If you run the project with that line in place, you will see that the awesomButton is not visible. Its attributes are set properly, but it hasn't been updated visually.
The problem is caused by the following check:
if state == self.state
When you call e.g. setBackgroundColor
, and button's state is .Disabled, but the attributes are set for .Normal. Thus, the method changeBackgroundColorForStateChange
is not called and the button's appearance is not updated.
I wasn't sure if the above check is needed for performance reasons or if you can just get rid it.
Is there any reason you require 8.1 not 8.0, on 8.0 it works fine
Even if you use a responsive UI color (e.g. .label) the button border doesn't change when appearance changes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.