Cocoa Touch:如何更改UIView的边框颜色和厚度? [英] Cocoa Touch: How To Change UIView's Border Color And Thickness?
本文介绍了Cocoa Touch:如何更改UIView的边框颜色和厚度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在检查员看到我可以改变背景颜色,但我也想改变边框的颜色和厚度,这是可能吗?
I saw in the inspector that I can change the background color, but I'd like to also change the border color and thickness, is this possible?
谢谢
推荐答案
您需要使用视图的图层来设置边框属性。例如:
You need to use view's layer to set border property. e.g:
#import <QuartzCore/QuartzCore.h>
...
view.layer.borderColor = [UIColor redColor].CGColor;
view.layer.borderWidth = 3.0f;
您还需要链接到QuartzCore.framework才能访问此功能。
You also need to link with QuartzCore.framework to access this functionality.
这篇关于Cocoa Touch:如何更改UIView的边框颜色和厚度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文