I am trying to resize a UICollectionView by setting it to 0 when loading the view controller, and then increasing its size using animation when the button is clicked. I tried several different things, but it does not change at all. Here are all the different things that I tried to change to a height of 0:
CGRect bounds = [self.collectionView bounds]; [self.collectionView setBounds:CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height - 100)];
....
CGRect frame = [self.collectionView frame]; [self.collectionView setFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height - 100)];
....
CGRect frame = self.collectionView.frame; frame.size.height -= 100; self.collectionView.frame = frame;
....
self.collectionView.clipsToBounds = YES; self.collectionView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
xcode resize uicollectionview cgrect
Neil faulkner
source share