Search code examples
iosobjective-cuiscrollviewautolayout

Why is a UIScrollView not scrolling vertically (using Auto Layout)?


Screenshot

My view hierarchy is

UIView

       UIScrollView

           UIView1

               -->UIView1.1

               -->UILabel

               -->UILabel

               -->UILabel

               -->UILabel  (bottom)

I am using Autolayout. I have tried all the ways and searched a lot. I did connect the bottom UILabel to the Bottom Layout of the UIView1 and set its priority to the 750 (the lowest of all). I have almost tried everything which is said on this forum and everywhere because everybody is saying same thing.

I am also adding the one view dynamically in UIView1.1. I have no idea why this is not working. Scrollview is not scrolling properly. Please help me. I am stuck on this for 3 days.


Solution

  •  scrollView.contentSize=CGSizeMake(320,758);
     scrollView.contentInset=UIEdgeInsetsMake(64.0,0.0,44.0,0.0);
    

    Finally these lines saved me.