Search code examples
iosxcodeautolayout

scrollView not scrolling all my contents


I'm using a scrollView and inside it used a view.

enter image description here

I set sizes like this:

enter image description here


enter image description here


enter image description here


enter image description here

I think the height of my view always is 959. but when I change the height from 959 to 2000, I see a orange line and when I use Editor->resolve Auto..->update frames my custom hight returns to 959.

even when I set height from pin I see red lines:

enter image description here

enter image description here

I want all my content scrolling. The content's height is 2000.


Solution

  • You check this following way:

    Scrollview Constraints:

    Set top to your super view

    Set bottom to your super view

    Set leading to your super view

    Set trailling to your super view

    Take One UIView into scrollview and apply following constraints(Equal to same Scrollview width and Height)

    Set top to scrollview

    Set bottom to scrollview

    Set leading to scrollview

    Set trailling to scrollview

    Dont forget to set Equal width to scrollview

    Then do add your all UIElements whatever you want. Consider like below:

    lable 1----> set necessory constraint to UIView

    lable 2----> set necessory constraint to UIView

    lable 3----> set necessory constraint to UIView

    lable 4----> set necessory constraint to UIView

    lable 5----> set necessory constraint to UIView and you give Bottom constraint to UIView

    Then scroll will automatically work..Dont adjust value like that.If you want more large screen Change View controller Simulated size to Freeform and there you adjust your prefer height and place scrollview based on that.