Is drag and drop of round rect button no longer available in Xcode 5? I can't seem to find it in the Interface Builder. I was guessing that this is one of the changes in iOS 7, but I just wanted to make sure.
To get round corners button using Interface Builder add a Key Path = "layer. cornerRadius" with Type = "Number" and Value = "10" (or other value as required) in the " User Defined RunTime Attribute " of the Identity Inspector of the button.
Can also make the rounded rect within the storyboard.
The Round Rect
button from Xcode 4 and previous versions appears to have been replaced with the System Default
button, which also happens to be clear. I.e. by default there is no white background with rounded corners, only the text is visible.
To make the button white (or any other colour), select the attributes inspector and scroll down to the View
section:
Select Background
and change it to White:
If you want rounded corners you can do so with a little bit of code.
Just ctrl-drag
from the button to your .h
file, call it something like roundedButton
and add this in your viewDidLoad
:
CALayer *btnLayer = [roundedButton layer];
[btnLayer setMasksToBounds:YES];
[btnLayer setCornerRadius:5.0f];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With