iOS7: UICollectionView appearing under UINavigationBar

后端 未结 5 1149
囚心锁ツ
囚心锁ツ 2021-02-01 06:56

I\'ve been building on iOS 7 for a while now but I\'ve yet to get this solved, I have a number of views with autolayout enabled that were created in Storyboard and are displayed

5条回答
  •  温柔的废话
    2021-02-01 07:05

    I had this problem before, just set the edge insents of the collection view with a top margin:

     [self.myCollectionVC.collectionView setContentInset:UIEdgeInsetsMake(topMargin, 0, 0, 0)];
    

    Where topMargin is the size of the nav bar, or whatever point you want the collection to start scrolling.

    In this way, your collection view will start scrolling just below the navigation bar, and at the same time it will fill the whole screen and you will see it if your nav bar is translucent.

提交回复
热议问题