I am very new to UICollectionView. And I'm really tired to find out a solution. I am trying to add Header to 3 Horizontally Row. I am using the collection view stream layout.
Here is my code that I am implementing:
- (void)awakeFromNib { self.collectionView.backgroundColor = [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0]; self.collectionView.backgroundColor = [UIColor clearColor]; self.collectionView.backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal; flowLayout.itemSize = CGSizeMake(130.0, 170.0); [self.collectionView setCollectionViewLayout:flowLayout];
My App crash in the viewForSupplementaryElementOfKind method when I initialize the title view.
The following is the alarm log:
The application terminated due to the unannounced exception "NSInternalInconsistencyException", reason: "there is no instance of UICollectionViewLayoutAttributes for -layoutAttributesForSupplementaryElementOfKind: UICollectionElementKindSectionHeader on path {length = 2, path = 0 - 0} '
ios objective-c uicollectionview uicollectionviewcell
Mihir za
source share