Closed mgallagher closed 8 years ago
You could override layoutSubviews and place your code after super.layoutSubviews()
Quick question here, is there a particular reason why you wouldn't use a classic (aka squared UIButton) with a round image?
button.setImage("myRoundImage", forState: .Normal)
In an ideal auto layout world, we want to avoid referencing frame
as much as possible :)
Forgive me if I'm using all the wrong terms here. I'm still quite new at this. Stevia's example project separates the View from the ViewController, and all subviews are layed out in the
render()
function in order for it to work nicely with the code injection plugin. As someone trying to move away from storyboards though, the issue I'm running into now is how to make a circular UIButton.Normally I would do this with an IB or by setting the runtime attributes directly in the interface builder:
Trying to do this in code/Stevia though, by the time
render()
is called, the button'sframe = 0.0
, so setting acornerRadius
does nothing and the button is still square. How would you approach this? One thing I've found is to explicitly set the frame size with theUIButton(frame: CGRect)
initializer, but something about setting the frame and then later inrender()
setting its height and width attributes to the same dimensions just doesn't sit well with me...