问题描述
我遇到了表格单元格重新排序的问题.我在单元格 contenview 中有一些带有一些背景颜色的视图.当我们拖动单元格进行重新排序时,它会使所有视图的颜色变为清除颜色.据我所知,这是一种标准行为.
I m having issue of table cells reordering. I have some views with some background color in cell contenview.When we drag cell for reorder its making all view's color to clear color.its a standard behavior as much i understand.
有没有办法在重新排序时不影响子视图颜色?
Is there any way to not affect subview color while reordering?
推荐答案
默认行为是允许用户通过查看单元格来最好地确定将其放置到何处,因此在实现其他内容之前强烈考虑该用例.
The default behavior is to allow the user to see though the cell to best determine where to drop it, so strongly consider that use case before implementing something else.
您可以尝试覆盖单元格上的 setHighlighted:
或 setSelected:
(或任何适用的子视图(如 UILabel
s) 以在控制器重新排序时忽略任何更改.
You could try overriding setHighlighted:
or setSelected:
on the cell (or any applicable subviews like UILabel
s) to ignore any changes when the controller is reordering.
这篇关于重新排序导致 subview 的背景颜色清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!