最新消息:20190529 VPS服务器已从腾讯云香港换为Vultr新加坡,主题仍用朋友推荐的大前端D8

[已解决]swift中画一条竖线view

iOS crifan 658浏览 0评论

想要画一条竖线,类似于这样的:

swift draw vertical line

ios – Drawing lines in Swift – Stack Overflow

iphone – Draw Vertical line in UIView – Stack Overflow

ios – Swift – UIView draw 1 pixel-width line – Stack Overflow

最后用:

let TimelineWidth:CGFloat = 2.0

let TimelineColor:UIColor = UIColor.darkGrayColor()

self.timelineView = UIView()

        //3. time line

        self.timelineView.backgroundColor = TimelineColor

        self.contentView.addSubview(self.timelineView)

        self.contentView.sendSubviewToBack(self.timelineView)

        //constrain(timelineView, leftTitleLabel, bulletImageView) {timelineView, leftTitleLabel, bulletImageView in

        constrain(timelineView, bulletImageView) {timelineView, bulletImageView in

            if isTopest {

                timelineView.top == bulletImageView.top

            } else {

                timelineView.top == timelineView.superview!.top

            }

            timelineView.bottom == timelineView.superview!.bottom

            //timelineView.left == leftTitleLabel.right + (BulletImageSize.width / 2) – (self.timelineWidth / 2)

            timelineView.centerX == bulletImageView.centerX

            timelineView.width == TimelineWidth

        }

去画了竖线:

转载请注明:在路上 » [已解决]swift中画一条竖线view

发表我的评论
取消评论

表情

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

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