TouchMoved and wrong screen range? or Bug in iOS?

前端 未结 3 1884
滥情空心
滥情空心 2021-01-28 13:40

I found interesting bug in iOS, but trying to belive that i\'m wrong. You have to do 2 things:

1) Create single-view template for iOS

2) Write small function i

3条回答
  •  面向向阳花
    2021-01-28 14:16

    I found this from one of Apple's tutorials on a finger-painting program:

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        CGRect              bounds = [self bounds];
        UITouch*    touch = [[event touchesForView:self] anyObject];
        firstTouch = YES;
        // Convert touch point from UIView referential to OpenGL one (upside-down flip)
        location = [touch locationInView:self];
        location.y = bounds.size.height - location.y;
    }
    

    Looks like you need to convert the touch to OpenGL coordinates to get the result you are expecting. Hope this helps.

提交回复
热议问题