Case study: ios source code and dimension case: ios source code
Source code: HTKDynamicResizingCell. HTKDynamicResizingCell provides TableViewCell/CollectionViewCel for Automatic Dimension calculation. You only need to set the AutoLayout constraint.
<Ignore_js_op>
Usage:
Use CocoaPods to add:
Pod 'htkdynamicresizingcell ',' ~> 0.0.1'
Pod install
Alternatively, add the HTKDynamicResizingCell folder in the demo to your project.
The usage is basically the same as that of 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 (10) + 1];
[Cell setupCellWithData: dataDict andImage: image];
Return cell;
}
For details, refer to the two Sample VC methods in the demo.
Http://ios.662p.com/thread-2270-1-1.html