PlateView adjustments
This commit is contained in:
parent
d023c60f54
commit
d34237ecf9
@ -27,6 +27,12 @@ class PlateView: UIView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fontSize: CGFloat = 10 {
|
||||||
|
didSet {
|
||||||
|
self.layoutSubviews()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
setup()
|
setup()
|
||||||
@ -124,15 +130,20 @@ class PlateView: UIView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override var intrinsicContentSize: CGSize {
|
override var intrinsicContentSize: CGSize {
|
||||||
guard self.bounds.width != 0 || self.bounds.height != 0 else {
|
|
||||||
return CGSize.zero
|
let height = fontSize/1.1 + 4
|
||||||
}
|
let width = height/PlateView.aspectRatio
|
||||||
|
return CGSize(width: width, height: height)
|
||||||
let curAspectRatio = self.bounds.height/self.bounds.width
|
|
||||||
if curAspectRatio >= PlateView.aspectRatio {
|
// guard self.bounds.width != 0 || self.bounds.height != 0 else {
|
||||||
return CGSize(width: self.bounds.width, height: self.bounds.width*PlateView.aspectRatio)
|
// return CGSize.zero
|
||||||
} else {
|
// }
|
||||||
return CGSize(width: self.bounds.height/PlateView.aspectRatio, height: self.bounds.height)
|
//
|
||||||
}
|
// let curAspectRatio = self.bounds.height/self.bounds.width
|
||||||
|
// if curAspectRatio >= PlateView.aspectRatio {
|
||||||
|
// return CGSize(width: self.bounds.width, height: self.bounds.width*PlateView.aspectRatio)
|
||||||
|
// } else {
|
||||||
|
// return CGSize(width: self.bounds.height/PlateView.aspectRatio, height: self.bounds.height)
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user