Autolayout requiring NSDisableScreenUpdates
Autolayout requiring NSDisableScreenUpdates
- Subject: Autolayout requiring NSDisableScreenUpdates
- From: Seth Willits <email@hidden>
- Date: Sun, 30 Aug 2015 15:57:50 -0700
My window's UI mainly consists of a stack view, but in the window's xib, there's nothing in the stack view to begin with. This means that after the xib loads, the window is tiny (like 70 x40).
In windowDidLoad I'm adding views to the stackview which actually make it the "real" size it should be, once autolayout happens. The problem is that the window is already shown and visible on screen before the new layout even takes effect, which is requiring me to wrap xib loading in NSDisableScreenUpdates/NSEnableScreenUpdates.
Is there something else I could/should be doing? (Besides obviously having the window loaded from the xib be the correct size to begin with, which simply isn't possible.)
- (void)windowWillLoad;
{
NSDisableScreenUpdates();
[super windowWillLoad];
}
- (void)windowDidLoad
{
[super windowDidLoad];
< at this point, the window is already visible >
...
[stackView addView:view inGravity:NSStackViewGravityTop];
...
[self.window layoutIfNeeded];
[self.window center];
NSEnableScreenUpdates();
}
--
Seth Willits
_______________________________________________
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