最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

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

Swift crifan 931浏览 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,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
61 queries in 0.101 seconds, using 18.84MB memory