I have a UICollectionView that contains some cells.
Each cell contains one UILabel inside it. There is one letter inside the label, it acts like a tile (as such). When more cells are added to the size of the UICollectionView , the size of the UICollectionViewCells changes as follows:
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { // NSLog(@"%s",__PRETTY_FUNCTION__); NSLog(@"the word array count is: %i",self.wordArray.count); if (self.wordArray.count <= 5) { return CGSizeMake(50,50); } else if (self.wordArray.count <= 6 ) { return CGSizeMake(30, 30); } else if (self.wordArray.count <= 8 ) { return CGSizeMake(10, 10); } else { return CGSizeMake(100,100); } }
Now I'm trying to resize the UILabel inside the cell every time I change the layout. How can I match label size to cell size using AutoLayout ? Also how can I update font size based on UILabel size?
source share