我有以下代码:
_swipeInleftGestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeInFromrightEdge:)]; _swipeInleftGestureRecognizer.minimumNumberOftouches = 1; _swipeInleftGestureRecognizer.maximumNumberOftouches = 1; [_swipeInleftGestureRecognizer setEdges:UIRectEdgeRight]; [self.vIEw addGestureRecognizer:_swipeInleftGestureRecognizer];- (voID)handleSwipeInFromrightEdge:(UIGestureRecognizer*)sender{ NSLog(@"swipe from right edge!!!!");}
手势附加到视图上,没有任何内容.
我错过了什么吗?
解决方法 我设法创建了一个解决方法.这很简单.我已经将UIWindow子类化并使用了touchesBegan / touchesMoved / etc.模拟手势识别的方法.有用. UIWindow不会自动旋转,因此我必须相应地转换触摸坐标.
这是我的转型版本:
- (CGPoint)transformPoint:(CGPoint)point { CGPoint pointInVIEw = point; if ([UIApplication sharedApplication].statusbarOrIEntation == UIInterfaceOrIEntationPortraitUpsIDeDown) { pointInVIEw.x = self.bounds.size.wIDth - pointInVIEw.x; pointInVIEw.y = self.bounds.size.height - pointInVIEw.y; } else if ([UIApplication sharedApplication].statusbarOrIEntation == UIInterfaceOrIEntationLandscapeleft) { CGfloat x = pointInVIEw.x; CGfloat y = pointInVIEw.y; pointInVIEw = CGPointMake(self.bounds.size.height - y,x); } else if ([UIApplication sharedApplication].statusbarOrIEntation == UIInterfaceOrIEntationLandscapeRight) { CGfloat x = pointInVIEw.x; CGfloat y = pointInVIEw.y; pointInVIEw = CGPointMake(y,self.bounds.size.wIDth - x); } return pointInVIEw;}总结
以上是内存溢出为你收集整理的ios – UIScreenEdgePanGestureRecognizer无法识别右边缘的手势全部内容,希望文章能够帮你解决ios – UIScreenEdgePanGestureRecognizer无法识别右边缘的手势所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)