[翻译] HTKDynamicResizingCell
HTKDynamicResizingCell
https://github.com/henrytkirk/HTKDynamicResizingCell
Subclassed UITableView/UICollectionView cells that will auto calculate their size so long as AutoLayout constraints are applied correctly. For iOS 7+. Works similar to how iOS 8s auto sizing of cells work.
继承自UITableView/UICollectionView的cell,支持自动布局,iOS7.0以上,就像iOS8的自动布局那样子。
Adding to your project:
添加到项目当中:
Cocoapods
CocoaPods is the recommended way to add HTKScrollingNavigationController to your project.
Add a pod entry for HTKScrollingNavigationController to your Podfile pod HTKDynamicResizingCell, ~ 0.0.1 Install the pod(s) by running pod install. Subclass HTKDynamicResizingTableViewCell or HTKDynamicResizingCollectionViewCell where you wish to use it. Make sure Auto-layout is setup correctly. See comments in classes for help.Autolayout Tips:
自动布局需要注意的地方:
For AutoLayout to be correct, make sure you complete the following:
为了能够正确的自动布局,你需要确定以下几点:
For height to calculate correctly, set hugging/compression priorites for all labels. This is one of the most important aspects of having the cell size itself. setContentCompressionResistancePriority needs to be set for all labels to UILayoutPriorityRequired on the Vertical axis. This prevents the label from shrinking to satisfy constraints and will not cut off any text. i.e. [self.label setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
Set PreferredMaxLayoutWidth for all labels that will have a auto height. This should equal width of cell minus any buffers on sides. i.e self.label.preferredMaxLayoutWidth = defaultSize - buffers;
Set any imageViews images correctly so they have proper size. Remember if you dont set a fixed width/height on a UIImageView it will use the 1x intrinsic size of the image to calculate a constraint. So if your image isnt sized correctly it will produce an incorrect value.
相关文章
- [翻译] UIColor-uiGradientsAdditions
- [翻译] ZFDragableModalTransition
- [翻译] FSLineChart
- python制作的翻译器基于爬取百度翻译【笔记思路】
- [翻译] TLMotionEffect 重力感应
- [翻译] GCDObjC
- 《Ext JS 4 First Look》翻译之一:新特性
- WebP官方翻译==Google推出新的图片格式WebP
- 【翻译】10个破坏程序的缓存错误
- SAP Spartacus i18n 的文本,和翻译相关的话题:internationalization
- Paper之BigGAN:《Large Scale Gan Training For High Fidelity Natural Image Synthesis》翻译与解读
- 翻译:职业游戏玩家的生活是什么样的?The life of a pro-gamer
- Emacs进阶之使用Mepla插件库及有道翻译安装(六)
- 内存级别/栅栏 ( Memory Barriers / Fences ) – 翻译
- 目标检测00-05:mmdetection(Foveabox为例)-白话给你讲论文-翻译无死角-1