1

カスタムテーブルビューセルにスワイプジェスチャレコグナイザーを追加しましたが、実際のデバイスでテストするまでは、問題なく機能していると思いました。

関連コード:

//in init of the custom table view cell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) 
    {
        //other irrelevant stuff

        //leftSwipeRecognizer
        UISwipeGestureRecognizer *leftSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(leftSwipe_Delete)];
        [leftSwipeRecognizer setDirection:UISwipeGestureRecognizerDirectionLeft];
        [self addGestureRecognizer:leftSwipeRecognizer];

        //rightSwipeRecognizer
        UISwipeGestureRecognizer *rightSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(rightSwipe_Add)];
        [rightSwipeRecognizer setDirection:UISwipeGestureRecognizerDirectionRight];
        [self addGestureRecognizer:rightSwipeRecognizer];
    }

    return self;
}

- (void) leftSwipe_Delete
{
    //never reaches this place on a real device, yet it comes here with a sim
}

- (void) rightSwipe_Add
{
    //never reaches this place on a real device, yet it comes here with a sim
}

誰かが私の解決策がどうなるか知っていますか?

4

0 に答える 0