Case study: ios source code and dimension case: ios source code

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.