·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> app软件开发 >> IOS开发 >> 自动计算尺寸列表功能案例ios源码

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

作者:佚名      IOS开发编辑:admin      更新时间:2022-07-23

源码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