我正在尝试针对iPhone使用基于全屏OpenGL ES 2的应用程序。
我可以使用它,但是由于某种原因,我无法在应用程序的底部16px上绘图。
注意:
屏幕。
触摸 16px处的。
在正确的地方。
为什么会这样呢?
这是我相当标准的触摸处理代码,如下所示:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
CGRect bounds = [glView bounds];
UITouch* touch = [[event touchesForView:glView] anyObject];
CGFloat scale = glView.contentScaleFactor;
CGPoint touch_location = [touch locationInView:glView];
touch_location.y = (bounds.size.height - touch_location.y);
touch_location.x *= scale;
touch_location.y *= scale;
//... draw stuff etc.
}
最佳答案
事实证明,对此没有真正的解决方案。我在应用商店上查看了其他绘画应用程序,但没有一个画在边缘。为了对称,它们中的大多数不画在底部和顶部大约16像素左右。我最终做了同样的事情。
关于ios - 在View(iOS)的底部边缘触摸不注册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23336824/