问题描述
我已关闭 autolayout 并且 viewcontroller 嵌入在导航控制器中.我正在使用 xcode 5,storyboard.
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); }
但是我错过了一些非常简单的方法吗?
推荐答案
在 xcode 5 中,在 storyboard 中选择你的控制器 > 在 attribute inspector 中禁用 adjust scroll view insets还要检查你是否设置了任何 contentinset
in xcode 5, in storyboard select your controller > in attribute inspector disable adjust scroll view insets also check if you have set any contentinset
编辑:我附上了一张照片