Re: How to detect rotation in progress in viewDidLayoutSubview
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: Tue, 29 Nov 2016 17:30:22 +0100
On 28.11.2016 at 16:50 David Duncan wrote:
> I think you can do everything you need to do in layoutSubviews
> (fundamentally it doesn’t matter if the device rotates or not, you
> just want to keep the view centered in its superview).
Right, makes sense.
> In general you should do as much as possible in layoutSubviews type
> methods. However sometimes you really do want to do something
> temporary specifically due to a transition between sizes,
> orientations, or size classes, and hence why we provide the
> “willTransitionTo” methods. If it isn’t a temporary change, then you
> don’t want the transition methods, as they are not always called at
> points when layoutSubviews will be.
Ok, I've now ditched "willTransitionTo" completely and everything is
done in my UIView's layoutSubviews method now. Seems to work fine.
Just one last thing: the documentation of layoutSubviews mentions
that this method, as its name implies, is meant to make adjustments
to subviews. But my UIView doesn't have any subviews at all. So
currently I'm basically (ab?)using layoutSubviews to make adjustments
to the UIView itself, not to its subviews, since there are none.
Is that allowed?
--
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