'UIView' is displayed using the snapkit (assuming 200 heights)
Use "equalToSuperview" to secure it to the floor
I want to lower the Y axis of the UI view to half the height.
self.tempView.snp.makeConstraints {
$0.leading.equalToSuperview().offset(-50)
$0.trailing.equalToSuperview().offset(50)
$0.height.equalTo(self.tempView.snp.width)
$0.bottom.equalToSuperview().offset(self.tempView.snp.height / 2)
}
You want the bottom of
tempView
to besuperview.bottom + tempView.height / 2
. Notice that this is the same as saying that the centre Y oftempView
should be equal to the bottom of its superview.If the offset is another ratio of the height, like 1/3 of the height, then I would use another view, placed at the bottom of the superview, to help: