我在表格视图中有一个自定义表格视图单元格,其中部分背景是白色,另一部分是灰色。工作起来就像一个魅力-直到重新排序显示:
x1c 0d1x的数据
我的问题是,重新排序控件都是灰色的,但我希望它是部分白色,基本上,它看起来像表的一部分。我可以使用以下代码到达视图:
for view in cell.subviews {
if String(describing: view.self).contains("UITableViewCellReorderControl") {
view.backgroundColor = .white
}
}
字符串
但是:在这里将视图的背景色设置为白色,看起来像这样:
的
我显然不想这样--我想让灰色一直移到右边。我尝试了各种其他的视图修改(例如,将框架的高度设置得小一点,CGTransform等),但似乎没有任何影响!
我真的很感激任何提示来解决这个问题!谢谢!
3条答案
按热度按时间yvgpqqbh1#
这段代码应该在你的可编辑单元格中工作。它激活了它的editMode,找到,隐藏子视图,并调整整个单元格的Reorder控件。关键是使用layoutSubviews()
字符串
vfwfrxfs2#
1.将灰线放在节头视图上;
2.将单元格的backgroundColor设置为白色;
字符串
nimxete23#
最简单的方法是使用单元格的backgroundView。
字符串