• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UIView size after rotation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >UIView size after rotation (From: Remco Poelstra <email@hidden>)

  • Prev by Date: Re: Distribution via DMG fails
  • Next by Date: Re: UIView size after rotation
  • Previous by thread: UIView size after rotation
  • Next by thread: Re: UIView size after rotation
  • Index(es):
    • Date
    • Thread