The gist demonstrates how to add a custom UIControlState
and set image for that state to a custom UIButton
.
Custom UIControlState
let myButton = MyButton() | |
myButton.setImage(UIImage(named: "ErrorCross"), forState: .Error) | |
myButton.setImage(UIImage(named: "ErrorCross"), forState: [.Error, .Highlighted]) | |
myButton.setImage(UIImage(named: "ErrorCross"), forState: [.Error, .Selected]) | |
myButton.setImage(UIImage(named: "ErrorCross"), forState: [.Error, .Selected, .Highlighted]) | |
myButton.error = true |
This comment has been minimized.
This comment has been minimized.
@pavankataria |
This comment has been minimized.
This comment has been minimized.
You could do this:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
and how would you define the
1 << 16
part if you wanted multiple custom states?