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 和之前版本中的 Round Rect
按钮似乎已替换为 System Default
按钮,这也恰好是清楚的.IE.默认情况下没有带圆角的白色背景,只有文本可见.
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.
要使按钮变为白色(或任何其他颜色),请选择属性检查器并向下滚动到 View
部分:
To make the button white (or any other colour), select the attributes inspector and scroll down to the View
section:
选择 Background
并将其更改为白色:
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屋!