here i've got screen designed in sketch:
there 2 buttons. designing such button in xcode , setting uibutton's corner radius way:
layer.cornerradius = 30 clipstobounds = true but result having strange:
you can see corner in center if left , right sides of button. can do?
to generate round corners on such button, if set cornerradius value 30, assuming height of button set 60.
this may not true on devices, depending on how handle layout. seeing image, looks button less high designed.
two options :
- use auto-layout , add constraint of "fixed height" on button, value of
60, button has height of 60 points. - implement
uibuttonsubclass, , inlayoutsubviewsmethod, setcornerradiushalf height ofboundsof button. way, time system re-draws button, corner radius updated appropriately.


Comments
Post a Comment