How to get the touch point in iOS8

In iOS 8, I set the default orientation for the device to be portrait, but sometimes I want to change some views and keyboard to landscape, so I call the setStatusBarOrientation API. In iOS 7, everything is fine, but in iOS 8 I can’t get the touch points correctly.

enter image description here

As shown in the picture above, when I rotate the view A to B, if I touch part of the shadow B, I cannot get the correct coordination, it always returns x = 640.

I get the x value as follows: x = [touch locationInView: [touch view]]. x

+5
source share

Source: https://habr.com/ru/post/1203679/


All Articles