• 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: How to detect rotation in progress in viewDidLayoutSubview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect rotation in progress in viewDidLayoutSubview


  • Subject: Re: How to detect rotation in progress in viewDidLayoutSubview
  • From: Andreas Falkenhahn <email@hidden>
  • Date: Sun, 27 Nov 2016 13:25:07 +0100

On 27.11.2016 at 00:04 David Duncan wrote:

> What are you trying to accomplish?

I want to keep my UIView centered on the screen so I need to
change its position when the device rotates. I'm currently
moving the UIView to the new position using

    [myView setFrame:...];

in viewDidLayoutSubviews().

> For most developers just looking at the aspect ratio in
> viewDidLayoutSubviews is sufficient.

Right, this would probably be a nicer way than using a flag.

> If you only want to do
> something for rotating, doing it as an alongside animation in
> viewWillTransitionToSize is usually what you want.

Do you mean that I should move the UIView in my "animateAlongsideTransition"
block instead of viewDidLayoutSubviews()? This seems to work as
well but I don't really know anything about those animation
handlers so I felt more comfortable doing this in viewDidLayoutSubviews().

> Also from your last thread, if you are trying to fix up a
> transform, it may be easier to use contentMode instead of transform
> for this case. AspectFit vs AspectFill will do the common letterbox
> vs clip without you needing to do anything further.

Yes, I'm actually using contentMode now. If this is set to
UIViewContentModeScaleToFill, I can just change the bounds
of the UIView and I'll get GPU-accelerated scaling for free.

--
Best regards,
 Andreas Falkenhahn                            mailto:email@hidden

_______________________________________________

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: How to detect rotation in progress in viewDidLayoutSubview
      • From: David Duncan <email@hidden>
References: 
 >How to detect rotation in progress in viewDidLayoutSubview (From: Andreas Falkenhahn <email@hidden>)
 >Re: How to detect rotation in progress in viewDidLayoutSubview (From: David Duncan <email@hidden>)

  • Prev by Date: Re: How to detect rotation in progress in viewDidLayoutSubview
  • Next by Date: Vertically Centered Colon
  • Previous by thread: Re: How to detect rotation in progress in viewDidLayoutSubview
  • Next by thread: Re: How to detect rotation in progress in viewDidLayoutSubview
  • Index(es):
    • Date
    • Thread