我有两个表视图控制器,它们都可以分割到具有滚动视图的同一视图。
由于某些原因,对于一个视图,滚动视图比另一个视图低。
正如你所看到的,第一个来自主视图控制器,并且比另一个更低。
我将帧的y位置设置为:
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, navBarHeight + statusHeight, self.view.bounds.size.width, self.view.bounds.size.height)];


发布于 2016-05-28 12:35:12
在设置子视图的框架时,您不需要考虑导航栏和状态栏高度。将y设置为0,而不是y等于navBarHeight + statusHeight。
如果仍然存在差距,还要将视图控制器的automaticallyAdjustsScrollViewInsets属性设置为false,以防止该行为:
self.automaticallyAdjustsScrollViewInsets = NO;发布于 2016-05-28 12:48:23
如果希望滚动视图从导航栏的正下方开始,可以将y设置为0,然后
self.automaticallyAdjustsScrollViewInsets = NO;
self.edgesForExtendedLayout = UIRectEdgeNone;发布于 2016-05-28 14:59:49
在你的故事板中,点击你的视图控制器。在Attributes inspector 中,取消选中 Adjust Scroll View Insets,您就完成了。

https://stackoverflow.com/questions/37495046
复制相似问题