美文网首页
UIImageView和UIButton的边框设置

UIImageView和UIButton的边框设置

作者: zhouios | 来源:发表于2017-03-22 09:22 被阅读0次

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;

相关文章

网友评论

      本文标题:UIImageView和UIButton的边框设置

      本文链接:https://www.haomeiwen.com/subject/kteupttx.html