Is it possible to make two UICollectionView, the first UICollectionView assigned as trigger and the second UICollectionView displaying different content of pictures so when the user select "Desire" there will be 7 pictures and 10 pictures when the user select "Nature":
Asked
Active
Viewed 548 times
1 Answers
0
Of course it's possible. You need to either set up different objects to serve as the data source for each collection view, or write your view controller to serve up different information for each collection view in the data source methods.
EDIT:
Take a look at this thread:
Multiple UICollectionView in one controller
It doesn't use a master/detail approach like you want, but it should at least get you started.
-
Can you give me code example?, sorry I still confuse @Duncan – GrumphyGuy May 29 '15 at 14:12
-
Wait, I think I already did what you"re trying to say. What I am trying to do is how to displaying those pictures when the user select Desire, Nature and the others ? @Duncan – GrumphyGuy May 29 '15 at 14:18
-
Add code that responds to selecting a cell in the top collection view by sending a reloadData message to the bottom collection view. – Duncan C May 29 '15 at 14:32
-
func controller(controller: UIViewController, didTapOnPicture image: UIImage?) { self.secondCollectionView.reloadData() } something like this ? @Duncan – GrumphyGuy May 29 '15 at 14:49
-
No. Implement the `collectionView:didSelectItemAtIndexPath:` method. In that method, check to see which collection view the user tapped on. If it's the top collection view, change the selected item and call the bottom collection view's reloadData method. – Duncan C May 29 '15 at 15:36