xib或者storyboard設置顏色偏問題(與代碼設置顏色不一致)

選中xib中的label,在右邊欄的第三個標籤頁中第三項是User Defined Runtime Attributesblog

添加一個keyPath,keyPath值爲layer.borderWidth,類型爲NSNumber,值爲你想要設置的邊框寬度。如圖:it

 

 

第二個是設置邊框的顏色,爲了兼容CALayer 的KVC ,你得給CALayer增長一個分類:io

@implementation CALayer (Additions)im

- (void)setBorderColorFromUIColor:(UIColor *)colorimg

{兼容

  self.borderColor = color.CGColor;di

}標籤

@endco

相關文章
相關標籤/搜索