[英]How can I know when UITableView is displaying Insertion/Deletion controls?
情況1.我滑動以刪除一行。 表進入編輯模式,但不顯示插入/缺失控制。
情況2。我按一個按鈕進入編輯模式,表格進入編輯模式, 並顯示“插入/刪除”控件。
如何以編程方式區分這兩種情況?
要知道是tableview's
edit
還是insert
哪個operation
已committed
則可以使用UITableView
delegate
方法知道它
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if(editingStyle == UITableViewCellEditingStyleDelete)
{
//delete operation
}
else if(editingStyle == UITableViewCellEditingStyleInsert)
{
//insert operation
}
}
要知道tableview是否處於編輯狀態,請使用UITableView's editing property
if ([tableView isEditing])
{
//TableView in editing mode so do any remaining operation need to be done
}
else
{
//TableView in not in editing mode
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.