Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
309 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...