I have a custom UICollectionViewCell whose content is also a collection and I would like to use UICollectionView to display its content. Is this possible? How would I accomplish this? I made the custom UICollectionViewCell also inheriting from UICollectionViewDataSource and define a UICollectionView internal property but things are not working as expected. Any idea?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
This is an example of
UICollectionView
inside aUICollectionViewCell
.https://github.com/irfanlone/Collection-View-in-a-collection-view-cell
From what I understand this isn't possible.
I tried doing it in storyboard and get the error:
"Container Views cannot be placed in elements that are repeated at runtime"
This is possible. Typically you would create a view controller which manages the inner collection view, and add the view of this view controller to the content view of the cell of the outer collection view.
You haven't given any description of you current attempts or problems encountered, so I can't offer much more than this.
It isn't possible to add a container view to the UICollectionVIew prototype cell in the storyboard, as BrettThePark mentioned.
What you can do is create a separate view controller in the storyboard and add this programatically to the view in the UICollectionViewCell subclass you're using in your UICollectionView. This view controller can off course be a UICollectionViewController.
Example:
Here is an example of how this can be done. We have a storyboard with a standard UITableViewController, a custom UITableViewCell, and a separate freeform custom UIViewController.
The result is that the custom view controller responds to the button taps. It is not the case that the view lifecycle methods are called as the view appears and disappears from the table.
I did this as a proof of concept, but for the project I'm working on I don't see any real advantage to having
CellContentViewController
be a view controller instead of just a custom view.Make your
UITableViewController
content asStatic
.