因为项目中要用到左右滑动进每个页面的下一级,用到了给cell添加手势
代码如下
UISwipeGestureRecognizer *recognizer; recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)]; [recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)]; [cell.contentView addGestureRecognizer:recognizer]; [recognizer release];
-(void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer { CGPoint location = [recognizer locationInView:mytabview]; NSIndexPath *indexPath = [mytabview indexPathForRowAtPoint:location]; NSLog(@"左滑动了 %d",indexPath.row); }