I'm trying to set my scrollview to the initial position, I'm trying with the contentoffset but I can not manage .. accessing the scrollview I always start from the bottom instead of from above .. some indication?
var scrollView = UIScrollView().then {
$0.alpha = 1
$0.contentMode = .scaleToFill
$0.translatesAutoresizingMaskIntoConstraints = false
//$0.isPagingEnabled = true
}
self.addSubview(scrollView)
scrollView.activate([
scrollView.centerXAnchor.constraint(equalTo: self.centerXAnchor),
scrollView.centerYAnchor.constraint(equalTo: self.centerYAnchor),
scrollView.heightAnchor.constraint(equalTo: self.heightAnchor, multiplier: 1),
scrollView.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 1),
])
It is because you are using UITextView
to show the text, instead of UILabel
. TextView is for editing and hence will always start at the bottom.