ios - UIButton width reporting incorrectly -
i'm trying create circular uibutton
in xcode setting corner radius equal half button width. problem is, storyboard says width of button 200
, reports 46.0
when access in uiviewcontroller
.
i've tried getting width using button.bounds.size.width
, button.frame.size.width
, button.layer.frame.size.width
, , button.bounds.width
, they're same.
the crazy thing didn't have trouble after created test project , added big button. major difference think of project used auto layout, adding width constraint didn't change anything.
for reference, i'm using xcode 6.1, swift, , it's iphone-only app targeting ios 8.
your button ending 46 points wide @ runtime, want 200 points? make sure 200 pt width constraint on button high priority, dial compression resistance , dial down content hugging (i'm assuming content naturally make smaller size seeing).
Comments
Post a Comment