- Simple solution for Dynamically adjust view as a blocks.
- Dynamically adjust height of collection view.
- No more White spaces
| While using Dynamic height only | While using Dynamic height with Custom Layout Made by Me |
|---|---|
customLayout.hcustomLayout.m
#import "customLayout.h"And use
<customLayoutDelegate>
to your controller.
columncount=2; // How much Columns you required miniInteriorSpacing=10; // Minimum Spacing you required if(![collectionView.collectionViewLayout isKindOfClass:[customLayout class]]){ customLayout *layout = [customLayout new]; layout.delegate=self; layout.columnCount=columncount; collectionView.collectionViewLayout = layout; [collectionView reloadData]; }
For getting height of Label I have written a method.
-(float)calculateHeightForLbl:(NSString*)text width:(float)width;