I have xib and I registered it:
[self.collectionView registerNib:[UINib nibWithNibName:@"MyCollectionView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"MyCollectionView"];
and I'd like to stick it to navigation bar - every time it must be under navigation bar (fe when I scroll my page). How to pin (stick) it to navigation bar?
in your flow layout files init you can use:
self.sectionHeadersPinToVisibleBounds = true
if you don't have custom layout file in the viewDidLoad
use:
let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout // casting is required as its feature of UICollectionViewFlowLayout
layout?.sectionHeadersPinToVisibleBounds = true
Objective C version
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout*) collection.collectionViewLayout;
layout.sectionHeadersPinToVisibleBounds = YES;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.