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

No shadow, background image and animation when added programatically #18

Open
perunworks opened this issue Jul 28, 2019 · 2 comments
Open

Comments

@perunworks
Copy link

Hi,
I'm adding buttons programatically. This is what I have and I can't seem to get the background image, shadow and animation working. All works when I add a button in storyboard view.

            let button = PMSuperButton() //UIButton()
            let bgrImage = UIImage(named: "someImage")
            //button.setImage(bgrImage, for: .normal) //-> this works ok
            button.setBackgroundImage(bgrImage, for: UIControl.State.normal)
            

            button.shadowColor = UIColor.gray
            button.shadowOffset = CGSize(width: 2, height: 2)
            button.shadowRadius = 2
            button.shadowOpacity = 2
            button.animatedScaleWhenSelected = 1
            button.animatedScaleWhenHighlighted = 1
            button.animatedScaleDurationWhenSelected = 1
            button.animatedScaleDurationWhenHighlighted = 1

Any idea what am I doing wrong?

@pmusolino
Copy link
Owner

Do you also declare it using Storyboard (do you re-initialize the button)?

@perunworks
Copy link
Author

No, I don't re-initialize it in Storyboard. I just create it programatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants