Ios 启用重新排列时无法从单元格检索转换状态
我在导航控制器中有一个Ios 启用重新排列时无法从单元格检索转换状态,ios,xcode,uitableview,state,Ios,Xcode,Uitableview,State,我在导航控制器中有一个UITableViewController。我正在用方法检索UITableViewCell类中单元格的状态 - (void)willTransitionToState:(UITableViewCellStateMask)state; 但是,当我启用使用 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndex
UITableViewController
。我正在用方法检索UITableViewCell
类中单元格的状态
- (void)willTransitionToState:(UITableViewCellStateMask)state;
但是,当我启用使用
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath;
该州的值为0
,2147483649
,2147483650
和2147483651
,而不是0
,1
,2
和3
是否有办法解决此问题或我是否遗漏了什么?支持的状态如下:
UITableViewCellStateDefaultMask (0),
UITableViewCellStateShowingEditControlMask (1),
UITableViewCellStateShowingDeleteConfirmationMask (2), and
UITableViewCellStateShowingEditControlMask | UITableViewCellStateShowingDeleteConfirmationMask (3).
因此,可以使用以下代码确认这些状态:
下面的操作适用于任何过渡状态,也可以处理滑动删除手势
- (void)willTransitionToState:(UITableViewCellStateMask)state {
[super willTransitionToState:state];
if (!cell.editing && !cell.showingDeleteConfirmation) {
// 0 - UITableViewCellStateDefaultMask
} else if (cell.editing && !cell.showingDeleteConfirmation) {
// 1 - UITableViewCellStateShowingEditControlMask
} else if (!cell.editing && cell.showingDeleteConfirmation) {
// 2 - UITableViewCellStateShowingDeleteConfirmationMask
} else if (cell.editing && cell.showingDeleteConfirmation) {
// 3 - UITableViewCellStateShowingEditControlMask | UITableViewCellStateShowingDeleteConfirmationMask
}
}