UITextView not visible on UIScrollView

前端 未结 3 1887
难免孤独
难免孤独 2020-12-22 09:12

Ok, so what I have is a UIScrollView that is constrained to all four sides of the main view, centered both vertically and horizontally, and set to have equal width and heigh

3条回答
  •  失恋的感觉
    2020-12-22 09:39

    If you want your scrollView only scrolls vertically you shouldn't set its height equal to its superView so remove it and just set the width to its superView and then it should calculate the height based on the subViews inside it I offer you to drag a UIView in your scrollView and set the constraints to its four sides, and name it containerView , then set its width equal to background view and start laying out your views inside it not inside the scrollview :) If Height of all views in the scrollView is clear, it can infer the scrollView's height in this case you can set a fixed height to your containerView like 800 to get rid of the red lines and check how it works :)

提交回复
热议问题