Thank you for reading my question,
like the title says, how can I use a button to control the collectionView
show/hide like hidden = false
.
I want the
collectionView
to hide it inviewDidload(ViewController)
method and show when I press the button.
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath
indexPath: NSIndexPath)
{
collectionView.hidden = true
}
I just can call collectionView
in func , How can I do this?
In viewDidLoad, self.collectionView.hidden = true
. Then you can toggle the hide/show using the following method:
@IBAction func toggleCollectionViewHideShow(sender: UIButton) {
self.collectionView.hidden = !self.collectionView.hidden
}