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.
Update for iOS 11
The fix is to implement the following line of code after in the viewDidLoad;
self.automaticallyAdjustsScrollViewInsets = NO;
In Xcode 5, in storyboard select your controller > in Attribute Inspector disable Adjust Scroll View Insets Also check if you have set any contentInset
Edit : I attached a pic
Inspector: Select scrollView and set up Content Insets - never
For me in xcode 7 and Swift 2.x I was populating a UIScrollView with a for loop and had to set the contentInset to zero.