我在导航控制器中有一个UITableViewController
。我使用方法
UITableViewCell
类中的单元格状态
- (void)willTransitionToState:(UITableViewCellStateMask)state;
完全没问题,但是当我启用
重新排列表格视图时- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath;
州的值为0
,2147483649
,2147483650
& 2147483651
代替0
,1
,2
& 3
。
有没有办法解决这个问题,或者我错过了什么?
答案 0 :(得分:0)
支持的状态如下:
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
}
}