The difficulty of dragging UIScrollView in XIB, and dragging uiscrollview in xib
Recently, there was a job of porting code in development, but that piece of code was written n years ago. Although it was not seen before, it was quite difficult, only when we really see it is a crater. Specifically, all interfaces are xib-based and do not use the Auto Layout constraint. In addition, the parent view is directly exclusive to a single control and cannot be adapted to iPhone X. As a result, in desperation, we had to start from scratch. Therefore, if you drag a scrollVIew and place a control on it to add constraints, an error is reported. This means that the contentSize of the scrollView is not set, when the system is running normally, it cannot be rolled. Obviously this is not the expected result, so we are looking for the attribute of setting contentSize, but we did not find how to set it in the sidebar, finally, the emperor finds a way to put a view on the scrollView. As long as two attributes are added to the original constraint, the view can be Horizontally in Container Vertically in Container, so far, contentSize has been set for scrollView. to scroll horizontally, You need to modify the value of Align Center X to: superView, to scroll vertically, You need to modify the value of Align Center Y to: superView.
By: Chu Guangfu