Add button programmatically?
wstudios opened this issue · comments
Hi, how do i create a FlourishUI button programmatically with rounded corners and the effects. I currently have the following:
let button = Button.buttonWithType(UIButtonType.System) as! Button
button.frame = CGRectMake(10, 10, 355, 32)
button.backgroundColor = UIColor(rgba: "#C2784D")
button.tintColor = UIColor(rgba: "#ffffff")
button.setTitle("Logout", forState: UIControlState.Normal)
button.addTarget(self, action: "logoutBtnTouched:", forControlEvents: UIControlEvents.TouchUpInside)
I appreciate any help. Thanks
The effects are pretty abstracted and mostly designed for Interface Builder. The border radius is pretty easy to do.. Just set button.layer.cornerRadius = 5
and you should see the results. The animation effects, you would have to extract out from Button.swift
which isn't terribly complex, but it's definitely a fair amount of code.
Thank you very much. My coding level is not great right now so i will use the cornerRadius option you mentioned and will leave the animation for now.