如何禁用用户可以将单元格移至其他部分的功能?我不想每次都显示警报;)
感谢:D
最佳答案
实现targetIndexPathForMoveFromRowAtIndexPath委托(delegate)方法:
- (NSIndexPath *)tableView:(UITableView *)tableView
targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath
toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath
{
if (proposedDestinationIndexPath.section != sourceIndexPath.section)
{
//keep cell where it was...
return sourceIndexPath;
}
//ok to move cell to proposed path...
return proposedDestinationIndexPath;
}
关于iphone - 不允许将单元格移到其他部分,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4949130/