解决tabView的滑动和点击

//-------------------首先要遵守UIPanGestureRecognizer代理 

@interface HomeController ()<UITableViewDataSource,UIGestureRecognizerDelegate>

//----------------定义 UIPanGestureRecognizer属性 

@property (nonatomic,strong) UIPanGestureRecognizer *panGestureRecognizer;

//-----------------------------注册滑动效果

//注册滑动效果

-(void)PanGestureRecognizer{

    [self.homeNavController.view addObserver:self forKeyPath:@"Kframe" options:NSKeyValueObservingOptionNew context:nil];

    self.panGestureRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(PanGesture:)];

   [self.view addGestureRecognizer:self.panGestureRecognizer];

    [self.panGestureRecognizer setCancelsTouchesInView:YES];

//让自己成为代理

    self.panGestureRecognizer.delegate = self;

}

//--------------------------------响应滑动效果

//响应滑动事件

-(void)PanGesture:(UIPanGestureRecognizer *)PanGRecognizer{

}

//接下来就按部就班的写tabView的数据源就行了.

Tap(点击)、Pinch(捏合)、Rotation(旋转)、Swipe(滑动,快速移动,是用于监测滑动的方向的)、Pan (拖移,慢速移动,是用于监测偏移的量的)以及 LongPress(长按)

万变不离其宗,同上就可以了

挥毫泼墨,书写人生篇章
原文地址:https://www.cnblogs.com/Jusive/p/5138526.html