Re: iPad interface orientation basics
Re: iPad interface orientation basics
- Subject: Re: iPad interface orientation basics
- From: David Duncan <email@hidden>
- Date: Tue, 18 May 2010 14:32:10 -0700
On May 17, 2010, at 8:58 AM, sebi wrote:
> I have a ViewController with a view. In that view there is an UIImageView background subview. Now, when I rotate the device I want to switch the image of the UIImageview so it fills the view again without being distorted. The only working method I found out up to now is to determine the correct values for the views frames and bounds by try and error and to hardcode them into the didRotateFromInterfaceOrientation method. Isn't there any example that shows how this is done properly? I downloaded all of apple samplecode and didn't find anything:
Why not just use the autoresizingMask to bind your image view to the size of its parent views? Then all you need to do (potentially) is determine if you want to display the correct image for landscape or portrait. No need to manually fiddle with the frame or bounds of the view at all (unless you want to do more complex orientation, in which case go for it).
But the coordinate systems are relatively simple. The frame is your view's coordinate system in its parent's coordinate system (that is, where you are in the world). The bounds is your view's coordinate system in its own coordinate system (that is, what is the extent of your world). It doesn't make sense to set your frame in terms of your parent's frame, because that is the wrong coordinate system – that would be like trying to locate your house in terms of the Earth's location in the Solar System. You can do it, but it is hard and there are much easier ways to go about the task.
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
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