启用重新安排后,无法从单元中检索转换状态
问题描述:
我在导航控制器中有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
}
}
完美,谢谢! – Elwin 2014-10-11 21:09:21