:
まず、テーブルの上に長押しジェスチャー認識を作成しますそれ自体を見る。
UILongPressGestureRecognizer* longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(onLongPress:)];
[self.tableView addGestureRecognizer:longPressRecognizer];
次に、選択された行を見つけることができ、そのルーチンとそれを扱う:
-(void)onLongPress:(UILongPressGestureRecognizer*)pGesture
{
if (pGesture.state == UIGestureRecognizerStateRecognized)
{
//Do something to tell the user!
}
if (pGesture.state == UIGestureRecognizerStateEnded)
{
UITableView* tableView = (UITableView*)self.view;
CGPoint touchPoint = [pGesture locationInView:self.view];
NSIndexPath* row = [tableView indexPathForRowAtPoint:touchPoint];
if (row != nil) {
//Handle the long press on row
}
}
}
私はそれを試していないが、私はジェスチャーを作ることによって、あなたが選択されていることを示すから行を保つことができると思いますテーブルビュー上の認識装置は、長押しが失敗するのを待つ。
あなたの定義で「無効なセル」とは何ですか? – omz
私はその "必要がないセル"と思う –