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

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

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.206 seconds, using 22.13MB memory