On Mon, 29 Nov 2010 12:05:42 -0500, Phillip Mills <phillip.mil...@acm.org> said:
>While attempting to track movement during a long press, I was surprised to 
>discover that the x direction of an application's UIWindow seems to be for the 
>portrait x dimension no matter how the device is turned.  Using [recognizer 
>locationOfTouch:i inView:[recognizer view]] matches the apparent x/y direction 
>of the rotated device while [recognizer locationOfTouch:i inView:nil] is only 
>relative to portrait.
>
>Even after seeing this, I'm having difficulty finding any documentation that 
>describes it.  (I'm curious whether I'm supposed to do something to keep the 
>values consistent or whether that's just the way it is.)  I'd assumed it would 
>be mentioned in the gesture recognizer docs where it describes the option (or 
>the UIWindow Class Reference, or the View Programming Guide) but I'm not 
>seeing it.  Suggestions of better places to look?

This isn't about gesture recognizers or anything like that; it's just a 
fundamental fact. The window is pinned to the device; window bounds are screen 
bounds. How else could it work? The fact that you're noticing it simply means 
that the architecture of your app is wrong. You should not be getting the 
location of the touch with respect to the window. You should be starting with a 
single primary subview of the window (a "root view") that is managed by a view 
controller that responds to rotation of the device as appropriate. That way, 
the coordinate system of the whole interface rotates to compensate, and you get 
your location in terms of that rotated coordinate system (or something further 
down the hierarchy). This is true of *any* app. Always use a root view with a 
view controller. m.

--
matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to