重新排列UITableViewCells会导致单元格内容中断 [英] Rearranging UITableViewCells causes cell contents to break
问题描述
我有一个要升级到iOS5的iOS4 iPad应用,但是有一个问题我不完全了解发生了什么.
I have an iOS4 iPad app that I'm upgrading to iOS5, and there is one issue that I don't fully understand what is going on.
所讨论的视图使用UITableView
及其许多子类UITableViewCells
来显示一系列不同(且可修改)的字段.每个单元格包含UI按钮,UITextFields
等,并用于轻松存储可变数量的控件.
The view in question uses a UITableView
with a number of subclassed UITableViewCells
to display a series of different (and modifiable) fields. Each cell contains UI buttons, UITextFields
, etc etc, and is used to readily store a variable amount of controls.
通过tableView:canMoveRowAtIndexPath:
,我们使用户能够使用拖放功能重新排列行的顺序.它在iOS4中可以完美运行,但是从iOS5开始,它已经无法正常运行.一个简单的交换使移动的单元格的文本字段看起来处于禁用状态(没有白色背景),而位于下方的子单元格可能会变成"bug",以一种无法预测的方式从屏幕上消失,从而将空白留在应有的位置.
Via tableView:canMoveRowAtIndexPath:
we've enabled the ability for the user to rearrange the order of the rows using drag-and-drop. It worked perfectly in iOS4, but as of iOS5 has ceased to function properly. A simple swap leaves the moved cell's text fields looking disabled (without their white background), and subsidiary cells further down can become 'bugged', vanishing from the screen in an unpredictable manner -- leaving white spaces where they should be.
导致此问题的iOS4和iOS5之间发生了什么变化,我该如何解决?
What changed between iOS4 and iOS5 that causes this issue, and how can I correct it?
推荐答案
从iOS 5开始,您还必须实现tableView:moveRowAtIndexPath:toIndexPath:
才能启用重新排序;你在这样做吗?
as of iOS 5, you must also implement tableView:moveRowAtIndexPath:toIndexPath:
to enable reordering; are you doing this?
这篇关于重新排列UITableViewCells会导致单元格内容中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!