iphone - 如何在 iphone 中使用圆角标签,UILabel Round Corners

标签 iphone ios

我在 View 中使用了一些标签。我想在我的 iPhone 应用程序中制作圆角标签。我使用以下代码来执行此操作,但它不起作用。我在使用该属性时遇到了一些错误。

label.layer.borderColor = [UIColor blueColor].CGColor;
label.layer.borderWidth = 4.0;
label.layer.cornerRadius = 8;

最佳答案

我遇到了同样的问题,在单元格中使用带有 backgroundColor 的 UILabel,并添加它以正常工作:

label.layer.cornerRadius=8.0;
label.clipsToBounds=YES;

关于iphone - 如何在 iphone 中使用圆角标签,UILabel Round Corners,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8530115/

相关文章:

iphone - 如何在 iPhone 的照片库中获取照片的名称?

ios - 将 UIGestureRecognizer 的所有事件从一个 UIView 传递到另一个 UIView( subview )

iphone - 输入后接受自动更正

ios - UITableView 行移动怪异

ios - 5.4.1-[Firebase/Core] [I-COR000022] Firebase Analytics不可用

iOS - Twitter 集成 1.1 oauth

iphone - 我的 xcmappingmodel 中的自定义策略将不会执行

iphone - 应用程序必须遵循 iOS 数据存储指南,否则它们将在包含 .sqlite3 的应用程序中被拒绝

iphone - 应用程序因 FMDB 执行更新查询而卡住

iphone - 如何使用 iPhone 操作我的电脑?