问题描述
我在视图中使用了一些标签。我想在我的iphone应用程序中制作圆角标签。我使用以下代码来执行此操作,但它不起作用。我有一些错误要使用这些属性。
I am using some labels in a view. I want to make rounded corner label in my iphone application. I use following code to do this but it's not work. I got have some errors to use that properties.
label.layer.borderColor = [UIColor blueColor].CGColor;
label.layer.borderWidth = 4.0;
label.layer.cornerRadius = 8;
推荐答案
很难确切知道你在问什么你没有包含你得到的错误。您是否已将 QuartzCore
框架添加到项目中,并将 #import< QuartzCore / CALayer.h>
添加到文件修改中这层?如果不是这样,请将错误和更多信息添加到您的问题中。
Hard to know for sure what you're asking as you didn't include the errors you're getting. Have you added the QuartzCore
framework to your project and #import <QuartzCore/CALayer.h>
to the file modifying the layer? If that's not it, add the errors and more info to your question.
编辑:您还可以 #import< QuartzCore / QuartzCore.h> ;
,如评论中所示。 QuartzCore.h
包括 CALayer.h
以及 QuartzCore $ c的其余部分$ c>组件。
you can also #import <QuartzCore/QuartzCore.h>
as suggested in the comments. QuartzCore.h
includes CALayer.h
along with the rest of the QuartzCore
components.
这篇关于如何在iPhone,UILabel Round Corners中使用圆角标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!