美文网首页Swift&Objective-C
IOS(swift) UIView设置边框

IOS(swift) UIView设置边框

作者: nooob | 来源:发表于2017-08-24 10:00 被阅读0次

swift设置UIview底部边框或者设置上下左右某个或者几个边框

1、github下载https://github.com/aaronn/UIView-Borders-Swift
2、将UIView+Borders.swift复制到项目中
3、调用addBorder方法。

举例:

为usernameView设置一个底部边框,宽度0.5,颜色lightGray。

code:

usernameView.addBorder(side: .bottom, thickness: 0.5, color: UIColor.lightGray)

效果:

image.png

UIView+Borders是自己在github上搜索到,感谢UIView+Borders的作者,简单实用。

相关文章

网友评论

    本文标题:IOS(swift) UIView设置边框

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