TouchMoved and wrong screen range? or Bug in iOS?

前端 未结 3 1885
滥情空心
滥情空心 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条回答
  •  旧时难觅i
    2021-01-28 14:36

    The view of root viewController always acts like portrait mode. You should insert a new view inside of the root one. And this new view will acts correctly, will give right size and coordinates according to Apple says.

    for example ;

    UIView *v = self;
    while ([[v superview] superview] != NULL) {
        v = [v superview];
    }
    
    UITouch *touch = [touches anyObject];
    CGPoint touchPoint = [touch locationInView:v];
    

    touchPoint will be the correct one.

提交回复
热议问题