0
点赞
收藏
分享

微信扫一扫

一个好用的侧滑第三方

1、这个抽屉效果类似于手机QQ,当我们想通过滑动手势打开手机QQ左抽屉时需要用手指在左边框向右滑动,而从中间向右滑动却不会产生打开左抽屉的效果。

然而MMDrawerController默认从中心视图控制器的任何位置右滑都可以打开左抽屉(请注意两者之间的差别)

2、MMDrawerController中应该有一个识别手势的方法,只要找到这个方法问题就可以得到解决。

解决过程:

1、在MMDrawerController文件夹下的各个.m文件中通过command+F搜寻GestureRecognizer,最终在MMDrawerController这个类中找到

-(MMOpenDrawerGestureMode)possibleOpenGestureModesForGestureRecognizer:(UIGestureRecognizer*)gestureRecognizerwithTouch:(UITouch*)touch;这个方法

2、在这个方法中找到了PointContainedWithinCenterViewContentRect: 这个判断条件,按住command点击后跳到它所在的位置,在这里找到了问题所在。解决方式如下:

MMDrawerController.m中1460行

-(BOOL)isPointContainedWithinCenterViewContentRect:(CGPoint)point{

//    CGRect centerViewContentRect = self.centerContainerView.frame;      //原文意思是把触发抽屉的手势识别放在整个屏幕中

CGRect centerViewContentRect = CGRectMake(0,0,50,self.centerContainerView.frame.size.height);//修改后的意思是把触发打开抽屉手势识别放在屏幕左侧宽50,高为屏幕高度的rect中

centerViewContentRect = CGRectIntersection(centerViewContentRect,self.childControllerContainerView.bounds);

return(CGRectContainsPoint(centerViewContentRect, point) &&

[selfisPointContainedWithinNavigationRect:point] ==NO);

}

举报

相关推荐

0 条评论