[翻译] 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 8's 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
HTKDynamicResizingTableViewCellorHTKDynamicResizingCollectionViewCellwhere 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 imageView's images correctly so they have proper size. Remember if you don't 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 isn't sized correctly it will produce an incorrect value.
Screen shot:
截图:

[翻译] HTKDynamicResizingCell的更多相关文章
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
- 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...
- 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?
0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点
在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...
随机推荐
- 第3章—高级装配—bean的作用域
bean的作用域 bean的默认作用域 Spring定义了多种作用域,可以基于这些作用域创建bean,包括: 单例(Singleton):在整个应用中,只创建bean的一个实例. 原型(Prototy ...
- php array_flip() 删除数组重复元素
在PHP中,用于删除数组中重复元素有一个可用的函数,那就是 array_unique(), 但是它并不是一个最高效的方法,使用array_flip() 函数将比array_uniqure()在速度上高 ...
- Window.localStorage
博客园 https://www.cnblogs.com/st-leslie/p/5617130.html 参考文档 https://developer.mozilla.org/zh-CN/docs/W ...
- 全网最详细的Git学习系列之安装各个Git图形客户端(Windows、Linux、Mac系统皆适用ing)(图文详解)
不多说,直接上干货! 目前Git图形客户端 TortoiseGit .SourceTree .GitUp .SmartGit .QGit .GitX .Gitnub.Tower .Git-cola . ...
- 新建用户组、用户、用户密码、删除用户组、用户(适合CentOS、Ubuntu系统)
这个知识点,模糊了好久.!!! 生产中,习惯如下: useradd,默认会将自身新建用户,添加到同名的用户组中.如,useradd zhouls,执行此命令后,默认就添加到同名的zhouls用户组中. ...
- 几种流行的开源WebService框架Axis1,Axis2,Xfire,CXF,JWS比较
几种流行的开源WebService框架Axis1,Axis2,Xfire,CXF,JWS比较 来源 XFire VS Axis XFire是与Axis2 并列的新一代WebService平台.之所 ...
- kd树 C++实现
参考:百科kd-tree /* * kdtree.h * * Created on: Mar 3, 2017 * Author: wxquare */ #ifndef KDTREE_H_ #defin ...
- Mysql日期类型大小比较---拉取给定时间段的记录
我们知道,mysql里边,日期类型有很多表现形式,date, datetime,timestamp等类型.考虑这样一种场景: 按时间段拉取给定时间段的内容,这时,我们就得使用日期类型的比较了. 表结构 ...
- js处理json数据,java处理json数据
一.js处理json数据 处理办法之一是把本机json数据或远程返回json数据用eval函数,使之变成DOM对象. 例如: var people = { "programmers" ...
- 如何应用ASP.NET MVC中的分部视图
概述: 在ASP.NET Web Form的开发经验中,对于User Control使用比较频繁,可以减少重复的代码,利于页面模块化,这个概念也被引入了ASP.NET MVC.即“分部视图”. 1.创 ...