自动计算尺寸列表功能案例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
轉載于:https://www.cnblogs.com/huasili/p/4120174.html
總結
以上是生活随笔為你收集整理的自动计算尺寸列表功能案例ios源码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HDU2795 Billboard
- 下一篇: Android开源之行之走进zxing,