Re: edgesForExtendedLayout outside of loadView/viewDidLoad
Re: edgesForExtendedLayout outside of loadView/viewDidLoad
- Subject: Re: edgesForExtendedLayout outside of loadView/viewDidLoad
- From: David Duncan <email@hidden>
- Date: Fri, 17 Jun 2016 07:38:53 -0700
You are probably still 1 (or more) views off.
The parent view controller needs to do layout to adjust to your changes, and there is no guarantee that self.view.superview is the view that needs layout to do it. You probably want self.parentViewController.view for that.
It likely works if you call it twice because of implementation details of layout.
--
David Duncan @ My iPhone
> On Jun 17, 2016, at 2:27 AM, Torsten Curdt <email@hidden> wrote:
>
> This is odd. This seems to eventually work
>
> self.edgesForExtendedLayout = UIRectEdge.None
> self.view.superview?.setNeedsUpdateConstraints()
> self.view.superview?.updateConstraintsIfNeeded()
>
> but only after the 2nd call.
>
> So as a work around I am calling it like this:
>
> self.edgesForExtendedLayout = UIRectEdge.None
> self.view.superview?.setNeedsUpdateConstraints()
> self.view.superview?.updateConstraintsIfNeeded()
> self.view.superview?.setNeedsUpdateConstraints()
> self.view.superview?.updateConstraintsIfNeeded()
>
> I am OK for now (given it's just for testing) but I would love to
> understand the "why".
> cheers,
> Torsten
> _______________________________________________
>
> 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
_______________________________________________
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