I have a UICollectionViewCell which I created using a visual XIB file.
The collection view is horizontally displayed.
I'm wanting to add another UICollectionView to this cell in the footer of the cell.
The cell itself is a "card" representing some information;
This diagram helps illustrate what I'm after;
The idea is that I can show/hide the dice imagery as many as needed, including zero; in a horizontal fashion as a child partial inside the current UICollectionCell.
Attempts using Storyboards;
The only solution I've got so far is to manually create 5 imageviews, then attach them to a collection outlet; and then I would need to do a for-loop to show/hide each die imagery.
In first VC register that collectionViewCell as sectionHeader:
tableView.register(UINib(nibName: DashboardPagerHeader.cellIdentifier, bundle: nil), forHeaderFooterViewReuseIdentifier: DashboardPagerHeader.cellIdentifier)
Create another CollectionViewCell in separate xib like before
Inside class of first collection view cell in awakeFromNib register cell created in step 4 like that:
override func awakeFromNib() { super.awakeFromNib() collectionView.delegate = self collectionView.dataSource = self collectionView.register(UINib(nibName: " DashboardHeaderCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: DashboardHeaderCollectionViewCell.cellIdentifier) }
You don't need tableview for that just in your collectionview cell xib drag another collection and set its scrolling property to vertical,then create xib from inner collectionview.
In outer collectionview cell use that method to set delegate and datasource
// code
override func awakeFromNib() {
super.awakeFromNib()
serInnerCollectionView()
}
func serInnerCollectionView() {
collectionViewInner.delegate = self
collectionViewInner.dataSource = self
collectionViewInner.register(UINib(nibName: " FooterCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "FooterCollectionViewCellIdentifier")
}
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.