Open blackchena opened 6 years ago
我在iOS 11中,Cell以及滚动条弹跳。
遇到滾動彈跳+1
log +1
log +2
log +3
滚动条弹跳 + 1
貌似因为 iOS11 tableView 自带动态 cell 高度功能(按照 cell 的autolayout 自动计算),所以和手动计算冲突了。
self.tableView.estimatedRowHeight = 0;
将 tableView的上述属性关掉。貌似可以解决“弹跳”问题, 我测试是可以的。
iOS 11 tableview 会自动开启 Self-sizing,即估高,可以通过下述代码关闭:
tableView.estimatedRowHeight = 0
tableView.estimatedSectionFooterHeight = 0
tableView.estimatedSectionHeaderHeight = 0
estimatedRowHeight = 0 ,关掉后 你们就没有遇到其他的问题吗,比如A push 到 B页面 然后在回到A页面,contentOffset.y 这个值就不对。
estimatedRowHeight = 0 ,关掉后 你们就没有遇到其他的问题吗,比如A push 到 B页面 然后在回到A页面,contentOffset.y 这个值就不对。
这个问题试试改变contentInsetAdjustmentBehavior
流批,意外解决一大困扰。
请问如何解决的,estimatedRowHeight = 0不管用
[[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.] . 请问这个问题是怎么解决的 ???
@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>>
log + 4
没人知道log 的问题吗?
@Xwoder 解决了么
@zhaoyunyi 没有解决,所以决定不再使用FD,改为手动计算行高了
现在如果要使用fd,还是得设置UILabel preferredMaxLayoutWidth,因为在调用systemLayoutSizeFittingSize计算cell高度时候,系统会为contentView 加上一个width的约束,库里面认为加的约束会因此失效。
log + 5
我也同样发现了这个问题,找了一下问题,发现是使用UITableViewCell的时候设置contentView出现了问题。也就是说在UITableViewCell中对contentView使用masonry加了约束。如下: [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { //add constraints }];
出现这个问题的原因是在 mas_makeConstraints: 方法中设置了self.translatesAutoresizingMaskIntoConstraints = NO; 如果想对self.contentView加约束可以使用苹果原生约束。
log + 6
请问[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>> 这个有解决的么
@CJaeson 那你最后怎么解决的...如果还使用Masonry,就没其他办法了吗
https://github.com/forkingdog/UITableView-FDTemplateLayoutCell/issues/371
UITableView+FDTemplateLayoutCell.m文件中templateCell.contentView.translatesAutoresizingMaskIntoConstraints = NO; 改为YES
nb 这个解决了行高的问题
@wendongsheng https://github.com/miniLV/UITableView-FDTemplateLayoutCell 试试
log的解决办法 ,试过有用。https://www.jianshu.com/p/ec9db5ab3785
@gaoypChina 使用Masonry的时候,应该吧这个属性设置为NO的,但是为什么会打印出来那么些的log
怎么样解决啊?
怎么样解决啊?
设置你自己的约束权限为750,高于默认高度44权限即可
解决办法为添加约束,比如:添加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();
}];
当注释掉
![screen shot 2017-09-22 at 9 19 19](https://user-images.githubusercontent.com/8891002/30725429-5f23a0cc-9f0a-11e7-9bb8-156b828535ce.png)
// templateCell.contentView.translatesAutoresizingMaskIntoConstraints = NO;
计算高度正常不知道为什么,附上两种情况的截图