Xcode 5中没有圆形矩形按钮? [英] No Round Rect Button in Xcode 5?
问题描述
Xcode 5中是否不再提供圆形矩形按钮的拖放?我似乎无法在Interface Builder中找到它。我猜这是iOS 7中的一个变化,但我只是想确定。
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.
推荐答案
<$来自Xcode 4的c $ c> Round Rect 按钮,以前的版本似乎已被系统默认
按钮取代,这也很明显。即默认情况下,没有带圆角的白色背景,只有文本可见。
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:
如果你想要圆角,可以用一点点代码完成。
只需 ctrl-drag
从按钮到 .h
文件,称之为 roundedButton
并将其添加到 viewDidLoad
中:
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];
这篇关于Xcode 5中没有圆形矩形按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!