Source Htkdynamicresizingcell,htkdynamicresizingcell provides automatic calculation of the size of the tableviewcell/collectionviewcel, as long as the appropriate AutoLayout set constraints.
<ignore_js_op>
How to use:
use Cocoapods to add:
pod ' Htkdynamicresizingcell ', ' ~> 0.0.1 '
pod Install
or simply add the Htkdynamicresizingcell folder in the demo to your project.
usage is basically the same as cell:
-(Uicollectionviewcell *) CollectionView: (Uicollectionview *) CollectionView Cellforitematindexpath: ( Nsindexpath *) Indexpath {
//Get cell
Htksamplecollectionviewcell *cell = (Htksamplecollectionviewcell *) [CollectionView Dequeuereusablecellwithreuseidentifier:htksamplecollectionviewcellidentifier ForIndexPath:indexPath];
//Load data
nsdictionary *datadict = Self.dataarray[indexpath.row];
//Sample image
UIImage *image = [UIImage imagenamed:[nsstring stringwithformat:@ "pic%i", Arc4random_uniform (Ten) + 1]];
[cell setupcellwithdata:datadict andimage:image];
return cell;
}
for details, please refer to the Demo two sample VC specific wording.
Detailed Description: http://ios.662p.com/thread-2270-1-1.html
Auto Calculate size list function case iOS source code