UITableViewAutomaticDimension [英] UITableViewAutomaticDimension

查看:47
本文介绍了UITableViewAutomaticDimension的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格视图,其中包含由代码创建的动态单元格.在 IOS 7 中为了确保单元格显示完整,我重写了方法 heightForRowAtIndexPath

I have a table view which has dynamic cells created by code. In IOS 7 to make sure the cell is displayed fully, I override the method heightForRowAtIndexPath

在 ios8 中重写此方法似乎使我的单元格只是一个在另一个之上,并且所有大小为 67.0003

overriding this method in ios8 seems to make my cells just be one on top of the other, and all sized 67.0003

我不想为单元格创建自动布局布局,它们太复杂而且已经制作了

I do not want to create an autolayout layout for the cells, they are too complex and already made

ios 8 有没有办法解决高度问题?

Is there a way to fix the height issue in ios 8?

推荐答案

heightForRowAtIndexPath 方法没有问题,在ios8下也很好用问题出在我写的 heightForRowAtIndexPath

There is no problem with the method heightForRowAtIndexPath, it works well in ios8 as well The problem was in my heightForRowAtIndexPath i wrote

CGSize size;
a bunch of ifs
size.height = something

在其他情况下我有

size.height+= something

and size.height 开始时并不总是 0

这篇关于UITableViewAutomaticDimension的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆