I have a static table view that all of its rows is fit in a view controller (no scrolling is needed).
I also have a subview that I want to add it in the last row, since this subview is tall, it should be scrolled. I did these things but none of them works:
1- I added a scrollView
in the last row and I have set constraints to fit it in the last row. Then I define it as an outlet and add the subview to it in viewdidload
. The subview is added but the scrolling doesn't work
2- I add a container in the last row, and I also add the scrollView
to on the subview and I have set constraints to fit it in the subview, then I added this subview that contains scrollView
to the container, but the scrolling doesn't work.
Could help me to do that? Thanks :)
You're probably just forgetting to set the scroll view's content size:
override func viewDidLoad() {
super.viewDidLoad()
let theView = UIView(frame: CGRect(x: 0, y: 0, width: ...))
scrollView.addSubview(theView)
scrollView.contentSize = theView.frame.size
}