Reputation: 953
I have two views. Parent view has content view which is UICollectionView
and for example UIButton
. How to change size (for example + 5px) of items with pressing the button?
Upvotes: 0
Views: 1261
Reputation: 433
You can have variable with collection view cell height and when click button increase this height then just reload collectionView and your cell will be higher
var CELL_HEIGHT = 44
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return CGSize(width: CELL_WIDTH, height:CELL_HEIGHT)
}
@IBAction func buttonClick(sender: AnyObject) {
CELL_HEIGHT = CELL_HEIGHT + 5
self.collectionView.reloadData()
}
Upvotes: 4