Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button doesn't use .Normal attributes in .Disabled state when they're not explicitly set #3

Closed
avf opened this issue May 7, 2015 · 0 comments
Labels

Comments

@avf
Copy link

avf commented May 7, 2015

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.

@aloco aloco added the bug label May 11, 2015
@aloco aloco closed this as completed in 80a3073 May 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants