The difficulty of dragging UIScrollView in XIB, and dragging uiscrollview in xib

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.