i have o content on my VC: TitleLabel and DescriptionLabel, sometimes i have very long description and it is not placed in my VC, so i decided to add scrollView there. But scroll is not working, and how can i calculate scrollView size depends on description?
lazy var scrollView: UIScrollView = {
let scrollView = UIScrollView()
return scrollView
}()
func configureUI() {
view.addSubview(scrollView)
scrollView.snp.makeConstraints { make in
make.top.equalTo(self.view.safeAreaLayoutGuide)
make.leading.trailing.equalTo(self.view.safeAreaLayoutGuide)
make.bottom.equalTo(self.view.safeAreaLayoutGuide)
}
scrollView.addSubview(titleLabel)
scrollView.addSubview(descriptionLabel)
titleLabel.snp.makeConstraints { make in
make.top.equalTo(self.view.safeAreaLayoutGuide)
make.left.right.equalTo(self.view.safeAreaLayoutGuide)
}
descriptionLabel.snp.makeConstraints { make in
make.leading.trailing.equalToSuperview()
make.top.equalTo(self.titleLabel.snp.bottom)
make.bottom.equalTo(self.view.safeAreaLayoutGuide)
}
}