想要画一条竖线,类似于这样的:
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