UITableViewCellAccessoryCheckmark和自动版式限制 [英] UITableViewCellAccessoryCheckmark and AutoLayout constraints
问题描述
我有自定义的的UITableViewCell
和管理我的细胞。当选择单元格,对号为presented,细胞查看内容
宽度收缩,我尾随约束标签移到左侧。我怎样才能有效避免内容的举动?
I have custom UITableViewCell
and manage selection of my cells. When the cell is selected and the checkmark is presented, the cell Content View
width shrinks and my labels with trailing constraints move to the left. How can I effectively avoid the content move?
我不想限制设置为龙头,因为我有灵活的tableview宽度和他们是右对齐。当我想通过它的 IBOutlets
我去了麻烦,因为我返回的多个子类的UITableViewCell $ C $更新code标签的限制C>在
cellForRow:
我在 didSelectRowAtIndexPath方法得到了无法识别的选择错误:试图设置在code约束时,
。任何优雅的解决方案?谢谢你。
I did not want to set the constraints to leading as I have flexible tableview width and they are right aligned. When I want to update label's constraints in code via its IBOutlets
I went into trouble as I return multiple subclasses of UITableViewCell
in cellForRow:
and I got unrecognized selector error in didSelectRowAtIndexPath:
when trying to set constraints in code. Any elegant solution? Thanks.
推荐答案
这行为是设计使然。
要得到你想要的行为,最简单的方法是设置在每一个细胞一个空的辅助视图,将所有内容向左移动相同的距离复选标记。
The simplest way to get the behavior you want is to set an empty accessory view on every cell which will move all the content to the left the same distance as the checkmark.
这篇关于UITableViewCellAccessoryCheckmark和自动版式限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!