> 
> 
>> Finally I settled with:
>> 
>> - (void)windowDidLoad 
>> {
>>      [super windowDidLoad];
>>      [ self performSelector: @selector(updateFrame:) withObject: @(0)  
>> afterDelay: 1 ];      
>> }
>> 
>> This has the (small) disadvantage that the window initially shows a boring 
>> grey custom view for one second.
> 
> And the view could be reset to have zero size at any time, whenever the auto 
> layout system lays out the view hierarchy again.
> 
> Don't try to bypass auto layout.  It's only going to end in frustration.  
> When you're using auto layout, either have your view class report an 
> intrinsic size, set up constraints to maintain its size, or set 
> translatesAutoresizingMaskIntoConstraints.  You can do the latter in 
> -windowDidLoad and it won't be overridden by the NIB-loading machinery.

This is the (hopefully) final solution:

- (void)windowDidLoad 
{
        [super windowDidLoad];
        self.neuView.autoresizingMask = NSViewHeightSizable;
        self.neuView.translatesAutoresizingMaskIntoConstraints = YES;
        [ self updateFrame: @(0) ]; ← sets the frame of my CustomView = neuView
}

Thanks a lot for your patience!

Kind regards,

Gerriet.

P.S. 

You said: "have your view class report an intrinsic size" -  how would I do 
this?
The documentation says something how to set "intrinsic content size" but it 
adds that "The view will not have this ... size at runtime".
Can one set an intrinsic size at runtime, to be used by autolayout?




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to