1

这可能是我遇到过的最奇怪的问题,我什至不知道从哪里开始寻找 - 非常感谢任何帮助。

更新到 Xcode 6.3(和 iOS 8.3 SDK)后,在我的一个旧 OpenGL 应用程序中出现了一个新问题,在宽屏显示器上,任何 x 坐标触摸的上限为 320。这意味着如果我触摸高于 320 的 x 坐标,它将在触摸中注册为 320。

现在奇怪的是,这只发生在我的 touchesBegan 函数中EAGLView——touchesMoved并且touchesEnded仍然可以检测到多达 568 个,即使它们具有完全相同的代码。

有谁知道这可能是什么原因造成的?以下是所有 3 个功能中使用的触摸代码:

- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
    UITouch *touch = [[event touchesForView:self] anyObject];
    CGPoint _location;
    _location = [touch locationInView:self];
    // Flip the y location ready to check it against OpenGL coordinates
    float temp = _location.x;
    _location.x = _location.y;
    _location.y = temp;
    NSLog(@"Touched at (%f,%f)", _location.x,_location.y); }
4

1 回答 1

1

终于弄明白了——看起来 iOS 8 在将 UIView 直接添加到应用程序委托中的窗口时会导致一些问题。我必须创建一个 UIViewController,将 UIView 添加到其中,然后使其成为根视图控制器。

于 2015-04-19T19:41:33.070 回答