class FilledRect : UIView {
init(frame: CGRect, level: CGFloat, color: UIColor) {
// super.init(frame: frame)
super.init(frame: CGRect(x: 0, y: 0, width: 1, height: 0)) //TODO: HAVE
self.layer.borderWidth = 1.0
let levelLayer = CAShapeLayer()
levelLayer.path = UIBezierPath(roundedRect: CGRect(x: frame.origin.x,
y: frame.origin.y,
width: frame.width * level,
height: frame.height),
cornerRadius: 0).cgPath
levelLayer.fillColor = color.cgColor
self.layer.addSublayer(levelLayer)
}
required init?(coder aDecoder: NSCoder) {
fatalError("Required, but Will not be called in a Playground")
}
}
이런거 쓸 때,
좌표를 더해서 붙여줘야 한다.
이런 식으로...
var view1 : UIView = FilledRect(frame: CGRect(x: 0, y: 0, width: 10, height: CGFloat(ph*ratio)), level: 1, color : colorLiteral(red: 0.9529411793, green: 0.6862745285, blue: 0.1333333403, alpha: 1))
var view2 : UIView = FilledRect(frame: CGRect(x: 0, y: 0, width: 10, height: CGFloat(ph*ratio) + CGFloat(pn*ratio)), level: 1, color : colorLiteral(red: 0.1764705926, green: 0.01176470611, blue: 0.5607843399, alpha: 1))
var view3 : UIView = FilledRect(frame: CGRect(x: 0, y: 0, width: 10, height: CGFloat(pl*ratio) + CGFloat(ph*ratio) + CGFloat(pn*ratio)), level: 1, color : colorLiteral(red: 0.521568656, green: 0.1098039225, blue: 0.05098039284, alpha: 1))
이 딴거 안통함.
imgView1.addSubview(imgBasal)
imgView1.snp.makeConstraints{
$0.left.equalToSuperview()
$0.top.equalToSuperview()
}
imgView11.addSubview(imgBasal1)
imgView11.snp.makeConstraints{
$0.left.equalToSuperview()
$0.top.equalTo(imgView1.snp.bottom)
}
'[진행] {BE} Python 3.1x' 카테고리의 다른 글
신형 맥북 에어 맥북 프로 (0) | 2019.04.02 |
---|---|
애플 정품 케이블 너무 얇아졌다 ㅠㅠ (0) | 2019.04.02 |
계산 잘 못하는 애플 코리아 (0) | 2019.03.18 |
스냅킷 & 배열 (0) | 2019.03.18 |
아이튠즈 구독 해지하지 (0) | 2019.03.15 |
최근댓글