为UIView绘制单边的boder

//为UIView绘制单边的boder

let TopBorder = CALayer()

TopBorder.frame = CGRect(x: 0.0, y:0, width: section3BottomView.frame.size.width, height: 1.0)

TopBorder.backgroundColor = UIColor.init(hexColor: COLOR_GRAY).cgColor

section3BottomView.layer.addSublayer(TopBorder)


OC版:

CALayer *TopBorder = [[CALayer alloc]init];

TopBorder.frame = CGRectMake(0, self.chatLabel.frame.size.height, self.chatLabel.frame.size.width, 0.5);

TopBorder.backgroundColor = [hlColor colorWithHexString:@"e0dfdf"].CGColor;

[self.chatLabel.layer addSublayer:TopBorder];

你可能感兴趣的:(为UIView绘制单边的boder)