why UIScrollView is leaving space from top in ios 6 and ios 7

Published

enter image description here

enter image description here

I have turned off Autolayout and viewcontroller is embedded in navigation controller.
I am using Xcode 5, Storyboard.

I don’t understand why is it leaving space from top.
Actually in storyboard i have put my label exactly below navigation bar.
But when i run it on simulator then it leaves space from top.

One of the hacky way to resolve this

-(void)viewWillLayoutSubviews
{
   self.scrollViewMain.frame = CGRectMake(0, -70, 320, 800);

   self.scrollViewMain.contentSize = CGSizeMake(320, 800);
}

But am i missing something very simple approach.

Source: Ios7 Questions

Published
Categorised as ios6, ios7, iphone, objective-c, uiscrollview Tagged , , , ,

Answers

The fix is to implement the following line of code after in the viewDidLoad;

self.automaticallyAdjustsScrollViewInsets = NO;


Mr. Cristian Schulist

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq