我在我的自定义tableview单元格中添加了一个滑动手势识别器,我认为它们工作正常,直到我在真实设备上进行测试。
相关代码:
//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
}
任何人都知道我的解决方案可能是什么?