UITableViewCell xib autolayout出现控件拉伸的问题

rollrock1987 2017-07-13 12:41:21
UITableViewCell xib autolayout

代码如下:
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 30;
[self.tableView setTableFooterView:[UIView new]];
[self.tableView setSeparatorColor:HEXTOCOLOR(0xe3e3e3)];


-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * cellId = @"NonCarCustomerTableViewCell";

NonCarCustomerTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if( !cell )
{
cell = [[[NSBundle mainBundle]loadNibNamed:cellId owner:self options:nil] lastObject];
}

[cell refreshCell:self.dataArray[indexPath.row]];

return cell;
}

‘畅行无忧....'与下面的线条之间存在固定的约束。’去付款‘按钮与下面的线条没有约束。
现在的情况是,当cell没有复用的时候间距比设置好的约束大了。当复用cell的时候约束正常了。
...全文
310 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
rollrock1987 2017-07-18
  • 打赏
  • 举报
回复
引用 1 楼 Xoxo_x 的回复:
self.tableView.estimatedRowHeight = 30;改为self.tableView.estimatedRowHeight = 130;试试
试过了 没什么效果
Mr_yawn 2017-07-18
  • 打赏
  • 举报
回复
你看看你xib中cell约束是否拉全了的。如果你显示“畅行无忧-典雅计划”是不需要多行显示的话,给个固定高度,并添加top,bottom约束看看。
Quinn士魁 2017-07-14
  • 打赏
  • 举报
回复
self.tableView.estimatedRowHeight = 30;改为self.tableView.estimatedRowHeight = 130;试试

29,027

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧