如图,在一个普通的UIView中包含着左右2个scrollView:左侧tableView、右侧collectionView。
显然右侧的collectionView的内边距被影响了,没有在导航栏的下面。
根据经验,首选想到了设置
http://blog.youkuaiyun.com/github_26672553/article/details/49925571
http://blog.youkuaiyun.com/github_26672553/article/details/49925629
self.automaticallyAdjustsScrollViewInsets = NO;
但在viewDidLoad 方法中设置后也没有作用,后来搜索发现还有个edgesForExtendedLayout 属性。
http://blog.youkuaiyun.com/cny901111/article/details/26529949
http://blog.youkuaiyun.com/wuyulunbi12580/article/details/52691155
self.edgesForExtendedLayout = UIRectEdgeNone;
有效!!!
本文介绍了一个关于iOS开发中UICollectionView布局的问题及解决方案。问题表现为CollectionView的内边距受导航栏影响,通过设置self.automaticallyAdjustsScrollViewInsets为NO无效。最终通过设置self.edgesForExtendedLayout为UIRectEdgeNone成功解决问题。

被折叠的 条评论
为什么被折叠?



