No Round Rect Button in Xcode 5?(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 中没有圆形矩形按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Xcode 5 中没有圆形矩形按钮?
基础教程推荐
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
