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

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

使用方法:


使用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

posted @ 2014-11-25 09:14  huasili  阅读(255)  评论(0编辑  收藏  举报