最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]swift添加一个水平线

Swift crifan 2421浏览 0评论

已有:

想要添加一个水平线:

swift draw horizontal line

iphone – Creating a horizontal line – Stack Overflow

ios – Swift xcode horizontal line – Stack Overflow

ios – Swift add line above to control – Stack Overflow

用代码:

    var seperatorLineView:UIView
let ColorSeperatorLine:UIColor = UIColor(hexString: "#DDEEFC")!
        self.seperatorLineView = UIView()
        //6.seperator line
        seperatorLineView.layer.borderWidth = 1
        seperatorLineView.layer.borderColor = ColorSeperatorLine.CGColor

        constrain(seperatorLineView, loginButton) {seperatorLineView, loginButton in
            seperatorLineView.top == loginButton.bottom + 12
            seperatorLineView.centerX == seperatorLineView.superview!.centerX
            seperatorLineView.width == loginButton.width
            seperatorLineView.height == 1

        }

效果是:

[总结]

画一个水平线,可以用:

        let seperatorLineView = UIView()
        seperatorLineView.layer.borderWidth = 1
        seperatorLineView.layer.borderColor = UIColor.redColor().CGColor

即可。

转载请注明:在路上 » [已解决]swift添加一个水平线

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
84 queries in 0.184 seconds, using 22.18MB memory