[翻译] 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 ...
随机推荐
- redis 数据类型 Hash
Redis 数据类型Hash:hash数据类型存储的数据和mysql数据库中存储的一条记录很类似. hash的一些操作: 比如数据库是user表,有id,name,age ,sex,可以建立与之对应的 ...
- 天猫消息盒子的CSS实现
css: body,h2,h3,ul,p{margin:0;padding:0;font-size:12px;} li{list-style: none; } a{text-decoration: n ...
- c++删除容器中的奇数
出自 c++ primer(4th)282页,26题 题意 数组ia[]={0,1,1,2,3,5,8,13,21,55,89};把ia复制到一个list容器中.使用单个迭代器参数版本的erase() ...
- jdbc报java.lang.ClassNotFoundException: com.mysql.jdbc.Drive
今天从开始写了一个jdbc连接mysql驱动的程序 真的是各种报错啊 首先这是代码 package com.dmeck; import java.sql.Connection; import java ...
- LOJ #6022. 重组病毒
Description 支持以下操作 1.access一个点 2.问一个点上面的重链的个数 3.换根 , 并access原来的根 Solution 对于重链个数 , 我们在 \(access\) 的时 ...
- 类class思维导图
- Spring 中的Enum HttpStatus 及HTTP状态码
官方API https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/HttpStatus.htm ...
- 从Linux系统安装到Web应用启动教程
概述 本文讲述web应用服务器安装配置教程,其中包括:Linux系统安装,Mysql数据库安装配置,Redis安装配置,Tomcat安装配置,MongoDB安装配置,Linux JDK安装使用,Ngi ...
- HDU 2578(二分查找)
686MS #include <iostream> #include <cstdlib> #include <cstdio> #include <algori ...
- 《JavaWeb从入门到改行》很好的复习资料: SQL语句到底怎么写 ?
本文用到的数据库如下: CREATE DATABASE exam; /创建部门表/ CREATE TABLE dept( deptno INT PRIMARY KEY, dname ), loc ) ...