Re: UIView size after rotation
Re: UIView size after rotation
- Subject: Re: UIView size after rotation
- From: WT <email@hidden>
- Date: Wed, 30 Mar 2011 10:34:54 -0300
On Mar 30, 2011, at 8:19 AM, Remco Poelstra wrote:
> Hi,
>
> In my UIVIewController -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration, I need to know the size of the view after it's rotated. Is there a way to calculate it if it can not be requested? The view's bounds are still in the old orientation, although the orientation property is already updated.
> Thanks in advance.
>
> Regards,
>
> Remco Poelstra
A view is a rectangular area so its width and height are exchanged after a 90-degree rotation (which is what happens when you go from landscape to portrait or portrait to landscape). The only other consideration is that the view may be clipped to its superview's bounds after the rotation.
So, to figure out a view's size after the rotation, exchange its width and height then clip the view to its superview's bounds after the rotation. There is a recursive element here in that you might have to do this to every view in the view hierarchy above your view-of-interest, ending at the window level.
Also, make sure to use the correct frames or bounds, and the correct coordinate systems.
WT
_______________________________________________
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