Reputation: 3195
hello friends i am using collection view in iPhone application to show list. I want to set the height of the collection view as per size of my list. how can I set it?
also have the problem when I use set selected method of cell in the collection view it will disable the user interaction.
I don't know what is the reason? Thank you.
Upvotes: 4
Views: 870
Reputation: 3195
"set selected method of cell in the collection view it will disable the user interaction."
this is solved by adding following method.
[newCell setSelected:YES];
[collectionView selectItemAtIndexPath:indexPath animated:YES scrollPosition:UICollectionViewScrollPositionNone];
accordingly.
as per given in this link
UICollectionView Select and Deselect issue
Thanks.
Upvotes: 5
Reputation: 3710
UICollectionView have a different realization other than UITableView, and i recommend to use RZCellSizeManager Or just learn how it works.
Upvotes: 0
Reputation: 9346
In heightforrowatindexpath
try doing this
return [array count]*(your cell's content height);
Upvotes: 0
Reputation: 8460
try like this,after completion of your collection view you can get content size based on that value you can change frame of collection.
dynamicHeight = collectionView.contentSize.height
Upvotes: 0