首页 > 移动平台 > 详细

自动计算尺寸列表功能案例ios源码

时间:2014-11-25 10:25:34      阅读:199      评论:0      收藏:0      [点我收藏+]

源码HTKDynamicResizingCell,HTKDynamicResizingCell提供自动计算尺寸的TableViewCell/CollectionViewCel,只要设置了合适AutoLayout的约束。
<ignore_js_op>bubuko.com,布布扣 

使用方法:


使用CocoaPods添加: 
pod ‘HTKDynamicResizingCell‘, ‘~> 0.0.1‘ 
pod install 

或者直接将demo中的HTKDynamicResizingCell文件夹添加到自己的项目中。 
用法基本和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; 


详细的请参考demo中两个Sample VC的具体写法。

详细说明:http://ios.662p.com/thread-2270-1-1.html

自动计算尺寸列表功能案例ios源码

原文:http://www.cnblogs.com/huasili/p/4120174.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!