I am Working in UICollectionView
added my Device Photos inside UICollectionViewCell
, now I want to create subview inside my UICollectionView
. Please suggest to me how to add subview
inside UICollectionViews
. Need any code or links.
Adding a subview is as simple as,
//Create subview
UIView *subview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.collectionView.frame.size.width, 20)];
//Add
[collectionView addSubview:subview];
//Bring to front so that it does not get hidden by cells
[collectionView bringSubviewToFront:subview];
//This will shift collectionView content down by 20px at top
[collectionView setContentInset:UIEdgeInsetsMake(subview.frame.size.height, 0, 0, 0)];
The above code will add a subview at top of collectionView. Is this what you are looking for? If not please provide more details in your question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With