Re: pls explain rotated iPhone coordinates to me
Re: pls explain rotated iPhone coordinates to me
- Subject: Re: pls explain rotated iPhone coordinates to me
- From: Matt Neuburg <email@hidden>
- Date: Tue, 15 Dec 2009 09:09:18 -0800
- Thread-topic: pls explain rotated iPhone coordinates to me
On or about 12/15/09 7:00 AM, thus spake "Luke the Hiesterman"
<email@hidden>:
> should be using a rect based on the bounds
Okay, but things are still reversed from the way I naively think they should
be. Just consider this code alone (I've moved everything into the view's
controller):
UIScrollView* sv = (UIScrollView*)self.view;
CGRect f = self.view.bounds;
sv.contentSize = CGSizeMake(f.size.height * 2.0, f.size.width);
Now, what I'm trying to do is make the content twice as *wide* as the scroll
view, so that I "page" from side to side, in this landscape-oriented app.
And I am succeeding in doing so!
The question is: why? As you can see from the code, I'm finding that I have
to take my bounds and use its *height* as my content size's *width* (and
double it, in order to get my two-page setup) and its *width* as my content
size's *height*. But why *is* that? The scroll view *is* rotated (i.e. I'm
not merely holding the iPhone sideways; things drawn in the scroll view in
IB with the view rotated are appearing correctly in the running app) so
shouldn't width mean width?
My code works perfectly, I just want to understand why. Does rotation not
really mean rotation? Am I supposed to manually apply a coordinate transform
that the docs have failed to warn me about? I did the three things we are
asked to do here:
<http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/i
PhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#/
/apple_ref/doc/uid/TP40007072-CH7-SW18>
m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden