forkingdog / UITableView-FDTemplateLayoutCell

Template auto layout cell for automatically UITableViewCell height calculating
MIT License
9.93k stars 2.01k forks source link

在iOS 11控制台输出这样的log,确实高度计算也有问题 #348

Open blackchena opened 6 years ago

blackchena commented 6 years ago

Changing the translatesAutoresizingMaskIntoConstraints property of the contentView of a UITableViewCell is not supported and will result in undefined behavior, as this property is managed by the owning UITableViewCell

当注释掉 // templateCell.contentView.translatesAutoresizingMaskIntoConstraints = NO; 计算高度正常不知道为什么,附上两种情况的截图 screen shot 2017-09-22 at 9 18 29 screen shot 2017-09-22 at 9 19 19

titman commented 6 years ago

我在iOS 11中,Cell以及滚动条弹跳。

puyanlin commented 6 years ago

遇到滾動彈跳+1

wujianbotju commented 6 years ago

log +1

hhszzheng commented 6 years ago

log +2

vbonluk commented 6 years ago

log +3

vbonluk commented 6 years ago

滚动条弹跳 + 1

roveretoa commented 6 years ago

貌似因为 iOS11 tableView 自带动态 cell 高度功能(按照 cell 的autolayout 自动计算),所以和手动计算冲突了。 self.tableView.estimatedRowHeight = 0; 将 tableView的上述属性关掉。貌似可以解决“弹跳”问题, 我测试是可以的。

iostalks commented 6 years ago

iOS 11 tableview 会自动开启 Self-sizing,即估高,可以通过下述代码关闭:

tableView.estimatedRowHeight = 0
tableView.estimatedSectionFooterHeight = 0
tableView.estimatedSectionHeaderHeight = 0
S209 commented 6 years ago

estimatedRowHeight = 0 ,关掉后 你们就没有遇到其他的问题吗,比如A push 到 B页面 然后在回到A页面,contentOffset.y 这个值就不对。

wangyutao0424 commented 6 years ago

estimatedRowHeight = 0 ,关掉后 你们就没有遇到其他的问题吗,比如A push 到 B页面 然后在回到A页面,contentOffset.y 这个值就不对。

这个问题试试改变contentInsetAdjustmentBehavior

iTofu commented 6 years ago

流批,意外解决一大困扰。

qussers commented 6 years ago

请问如何解决的,estimatedRowHeight = 0不管用

diaotongt commented 6 years ago

[[LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of the contentView of a UITableViewCell is not supported and will result in undefined behavior, as this property is managed by the owning UITableViewCell.] . 请问这个问题是怎么解决的 ???

Xwoder commented 6 years ago

@iostalks 我使用你的那3行代码,但是依然会打印日志

[LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of the contentView of a UITableViewCell is not supported and will result in undefined behavior, as this property is managed by the owning UITableViewCell. Cell: <CellOfMine: 0x7fba5306d800; baseClass = UITableViewCell; frame = (0 0; 320 44); layer = <CALayer: 0x604000621be0>>
WalkerZhan commented 6 years ago

log + 4

zhaoyunyi commented 6 years ago

没人知道log 的问题吗?

zhaoyunyi commented 6 years ago

@Xwoder 解决了么

Xwoder commented 6 years ago

@zhaoyunyi 没有解决,所以决定不再使用FD,改为手动计算行高了

blackchena commented 6 years ago

现在如果要使用fd,还是得设置UILabel preferredMaxLayoutWidth,因为在调用systemLayoutSizeFittingSize计算cell高度时候,系统会为contentView 加上一个width的约束,库里面认为加的约束会因此失效。

inrtgdje commented 6 years ago

log + 5

CJaeson commented 6 years ago

我也同样发现了这个问题,找了一下问题,发现是使用UITableViewCell的时候设置contentView出现了问题。也就是说在UITableViewCell中对contentView使用masonry加了约束。如下: [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { //add constraints }];

出现这个问题的原因是在 mas_makeConstraints: 方法中设置了self.translatesAutoresizingMaskIntoConstraints = NO; 如果想对self.contentView加约束可以使用苹果原生约束。

ZYongjie commented 6 years ago

log + 6

wendongsheng commented 6 years ago

请问[LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of the contentView of a UITableViewCell is not supported and will result in undefined behavior, as this property is managed by the owning UITableViewCell. Cell: <CellOfMine: 0x7fba5306d800; baseClass = UITableViewCell; frame = (0 0; 320 44); layer = <CALayer: 0x604000621be0>> 这个有解决的么

YBYHunter commented 6 years ago

@CJaeson 那你最后怎么解决的...如果还使用Masonry,就没其他办法了吗

gaoypChina commented 6 years ago

https://github.com/forkingdog/UITableView-FDTemplateLayoutCell/issues/371

UITableView+FDTemplateLayoutCell.m文件中templateCell.contentView.translatesAutoresizingMaskIntoConstraints = NO; 改为YES

JimmyPeng4iOS commented 6 years ago

nb 这个解决了行高的问题

miniLV commented 5 years ago

@wendongsheng https://github.com/miniLV/UITableView-FDTemplateLayoutCell 试试

kenan0620 commented 4 years ago

log的解决办法 ,试过有用。https://www.jianshu.com/p/ec9db5ab3785

BeyondScience commented 4 years ago

@gaoypChina 使用Masonry的时候,应该吧这个属性设置为NO的,但是为什么会打印出来那么些的log

kedu commented 4 years ago

怎么样解决啊?

kedu commented 4 years ago

怎么样解决啊?

fifyrio commented 4 years ago

设置你自己的约束权限为750,高于默认高度44权限即可

AgoniNemo commented 3 years ago

解决办法为添加约束,比如:添加priorityHigh

[view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.contentView).inset(16);
        make.top.equalTo(self.contentView).offset(50);
        make.bottom.inset(10).priorityHigh();
}];