我有一個UITableView
與其中的一些自定義單元格。在這些自定義單元格中,我定義了一個觸發此表的編輯模式的UILongPressGestureRecognizer
。所以當有人按住1.5秒時,表格進入編輯模式。觸發器setEditing:動畫:不使用編輯按鈕
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(startEditMode:)];
觸發:
- (void)startEditMode:(UISwipeGestureRecognizer *)recognizer {
if (self.allowEdit) {
UITableView *table = (UITableView *)self.superview;
[table setEditing:YES animated:YES];
}
}
但是我想做的是當表進入編輯模式,因爲我需要顯示/隱藏在這種情況下,一些額外的按鈕檢測。但由於某種原因,在我的視圖控制器,這是從未執行:
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
NSLog(@"SET EDITING");
[super setEditing:editing animated:animated];
}
任何建議爲什麼?這只是在使用UINavigationController中默認提供的適當編輯按鈕時才被調用?
或者我該如何檢測UITableView何時進入編輯模式?