記錄幾個 CALayer 的重要屬性 (三)

記錄幾個 CALayer 的重要屬性

有關邊框配置

  • borderWidth : 配置邊框寬度
@property CGFloat borderWidth;
/* The width of the layer's border, inset from the layer bounds. The
 * border is composited above the layer's content and sublayers and
 * includes the effects of the `cornerRadius' property. Defaults to
 * zero. Animatable. */

配置層邊框的寬度, 從本層的邊緣. 對圓角同樣有效
borderWidth 的配置方式如下:

CALayer *subLayer = [CALayer layer];
subLayer.borderWidth = 3;
  • borderColor : 配置邊框顏色
@property CGColorRef borderColor;
/* The color of the layer's border. Defaults to opaque black. Colors
 * created from tiled patterns are supported. Animatable. */

配置層邊框的顏色, 默認顏色爲黑色 從本層的邊緣. 對圓角同樣有效
borderColor 的配置方式如下:

subLayer.borderColor = [UIColor whiteColor].CGColor;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章