Open yyc123 opened 7 years ago
换成系统方法 _tableView.estimatedRowHeight = 80.0; _tableView.rowHeight = UITableViewAutomaticDimension; 就不会出现问题
@yyc123 would you mind to add a screenshot of your auto layout?
@yyc123 are you sure you code run on iOS 10.3, sounds like 10.2 issues.
@weekwood 我是在iOS 10.3上发现问题的
@wws19125 show me logs?
unfortunately,I got nothing in my xcode(8.3 , debug mode) output window
@wws19125 then can you describe your issue, and show me screenshot
as you seeing, the height for the row is not correctly calculated
here is the code
#ifndef __IPHONE_10_3
///FIXME: iOS 10.3上会出问题
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return [tableView fd_heightForCellWithIdentifier:@"cell" cacheByIndexPath:indexPath configuration:^(JHBaseInfoCell * cell) {
[self cofigureCell:cell AtIndexPath:indexPath];
}];
}
#endif
@yyc123 is right
@wws19125 which version you used? 1.6.beta? and can you show me your autolayout code or xib. demo will be awesome
[LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x600000299410 UITableViewCellContentView:0x7fb28d707f00.width == 375>", "<NSLayoutConstraint:0x6000004890b0 UITableViewCellContentView:0x7fb28d707f00.width == 320>" )
Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600000299410 UITableViewCellContentView:0x7fb28d707f00.width == 375>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 2017-05-05 12:44:56.406050+0800 CitySpeedLoan[9178:206278] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x600000299410 UITableViewCellContentView:0x7fb28d707f00.width == 375>", "<NSLayoutConstraint:0x600000489010 UITableViewCellContentView:0x7fb28d707f00.width <= 320>" )
Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600000489010 UITableViewCellContentView:0x7fb28d707f00.width <= 320> ios 10.3 bug
pod 'UITableView+FDTemplateLayoutCell', '~> 1.5.beta'
@licansir this issue fixed 1.6.beta, feel free to try branch 'master' too. #302
ok verygood
@yyc123 try 1.6.beta if your issue fixed too
FDTemplateLayoutCell layout cell created - MLSettingsSubtitleSwitchTableViewCell FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 68.66666666666667 FDTemplateLayoutCell cached by index path[0:4] - 68.66666666666667 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:7] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:11] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:13] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:4] - 68.66666666666667 FDTemplateLayoutCell hit cache by index path[0:7] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:11] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:13] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:4] - 68.66666666666667 FDTemplateLayoutCell hit cache by index path[0:7] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:11] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:13] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:4] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:7] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:11] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:13] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:4] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:4] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:7] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:7] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:11] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:11] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:4] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:7] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:11] - 54.33333333333334 FDTemplateLayoutCell calculate using system fitting size (AutoLayout) - 54.33333333333334 FDTemplateLayoutCell cached by index path[0:13] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:4] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:4] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:7] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:7] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:11] - 54.33333333333334 FDTemplateLayoutCell hit cache by index path[0:11] - 54.33333333333334
发现[0, 4] 这个cell在多次计算后就不准确了 xcode8.3.2 iOS10.3 pod 'UITableView+FDTemplateLayoutCell', '~> 1.6'
还是不准确啊@weekwood
@liguangyi1991 1.6?
嗯,是1.6,约束什么都没有问题,只是Label的会出现比较大的内间距,感觉像是这个Label被纵向拉伸啦@weekwood
1.6 还是有问题,具体细节和解决方法我描述到了这里:https://github.com/forkingdog/UITableView-FDTemplateLayoutCell/issues/315
+1 真的计算不准
8.0以上,系统现在已经提供了适配方法 self.tableView.estimatedRowHeight = 150; self.tableView.rowHeight = UITableViewAutomaticDimension; 计算很准确,不会出现上面的情况
cell布局使用xib AutoLayout, 添加的约束没问题,label没有随内容换行,控制台有约束报错信息: Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( <NSLayoutConstraint:0x60800009c020 UITableViewCellContentView:0x7ff80263ff00.width == 375>, <NSLayoutConstraint:0x608000097660 UITableViewCellContentView:0x7ff80263ff00.width == 229.5> ) 求解