Reputation: 189
When i put my app in iOS 7, the top cell gets cover by my navigation bar. I tried using edgesForExtendedLayout but it just gives my an iOS 6 look of the app. I'm trying to take advantage of the translucent bar in iOS 7 but edgesForExtendedLayout doesn't help.
Is there a way to make this cell appear below de the navigation bar?
Upvotes: 1
Views: 1255
Reputation: 57060
You have several options. UICollectionView
is a subview of UIScrollView
.
The most simple method is to turn your view controller into a subclass of UICollectionViewController
, which takes care of these issues automatically. More information here.
If you cannot, either set automaticallyAdjustsScrollViewInsets
to YES
in your view controller, or manually set the contentInsets of your collection view manually in viewDidLayoutSubviews
like so:
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews]
[_collectionView setContentInset:UIEdgeInsetMake(self.topLayoutGuide.length, 0, self.bottomLayoutGuide.length, 0)];
[_collectionView setScrollIndicatorInsets: _collectionView.contentInset];
}
Additional benefit of using UICollectionViewController
is the support of useLayoutToLayoutNavigationTransitions
, which can create cool transitions between collection view layouts (like, for example, Apple's mobile calendar app).
Upvotes: 1