UIImageView和UIButton的边框设置

2017-03-22  本文已影响0人  zhouios

imageView是UIIamgeView

//边框的颜色
imageView.layer.borderColor = [UIColor whiteColor].CGColor;
//边框的宽度
imageView.layer.borderWidth = 5;

confirmBtn是UIButton

//边框的宽度
[self.confirmBtn.layer setBorderWidth:1];
//边框的颜色
CGColorRef color = [UIColor orangeColor].CGColor;
[self.confirmBtn.layer setBorderColor:color];

//btn的内容剧中
confirmBtn.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
confirmBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
上一篇 下一篇

猜你喜欢

热点阅读