开发者

Why does ipad return invalid touch locations?

I noticed a crash in our application, and traced it back to an interesting problem.

I have a UIVIew that is 320x480. It overrides touchesEnded:withEvent: and checks the touch location to do some logic.

The interesting thing is that on ipad (only) we were receiving touch events with an X range from 0 to 320... inclusive. That's the important bit.

How does a view with 320 pixels across have a potential for 321 different touch locations? Is this a known bug? Is there some reason for it?

To replicate this, run your iphone app on an ipad (in the compatibility emulator mode), touch down in a view and slide your finger off one side or the oth开发者_如何学编程er. You'll receive a touch event with an x value of 0 or 320. You can do this for Y too. I can't replicate this on an iphone.


A touch on a capacitive touch display isn't physically a single pixel, more likely a fuzzy noisy blob with only a probable location and diameter. So this could be a result of some post processing adjustments between the analog measurements and the event handler.

Or this could also just be a bug. Go ahead and report it to Apple.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜