• 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 final frame after device rotation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UIView final frame after device rotation


  • Subject: Re: UIView final frame after device rotation
  • From: David Duncan <email@hidden>
  • Date: Tue, 02 Apr 2013 11:37:19 -0700

On Apr 2, 2013, at 10:59 AM, Markus Spoettl <email@hidden> wrote:

>  I have a hard time figuring out how to get the frame (in the window coordinate system) a view will rotate to, when the rotation has just begun.

What are you trying to do?

Typically you don't need to worry about this. The root view controller's view will have its frame set properly by UIKit, and then all of your other views will resize with respect to that view's bounds, and as such you don't need to know how to get the final frame of that view.

>
> I'm observing UIApplicationDidChangeStatusBarFrameNotification on NSNotification's defaultCenter. When this notification is delivered, the rotation seems to be in progress. At that point I need to know the final frame the view is being rotated to.
>
> I've tried everything I could think of including these:
>
> r1 = [[view superview] convertRect:[view frame] toView:nil];
> r2 = [[view window] convertRect:[view bounds] fromView:view];
> r3 = [view convertRect:[view bounds] toView:nil];
> r4 = [[view window] convertRect:[[[view layer] modelLayer] frame] fromView:[view superview]];
>
> All get me the same results all the time (expected) but depending on the rotation direction and the previous orientation, I get nonsensical results like
>
> {{52, 0}, {268, 480}}
>
> or
>
> {{-80, 80}, {416, 320}}
>
> for a window-filling view (with a navigation bar visible). This led me to believe that I'm getting coordinates the view is set up to rotate from when the orientation changes. I can't for the life of me find a way to get the new frame that the view will have when the animation is complete.
>
> I feel like I'm missing something obvious, any ideas?
>
> Regards
> Markus
> --
> __________________________________________
> Markus Spoettl
> _______________________________________________
>
> 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

--
David Duncan


_______________________________________________

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

  • Follow-Ups:
    • Re: UIView final frame after device rotation
      • From: Markus Spoettl <email@hidden>
References: 
 >UIView final frame after device rotation (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Re: Setting position of CALayer doesn't animate
  • Next by Date: Re: Setting position of CALayer doesn't animate
  • Previous by thread: UIView final frame after device rotation
  • Next by thread: Re: UIView final frame after device rotation
  • Index(es):
    • Date
    • Thread