On 9 Jul 2015, at 16:18, Ken Thomases <k...@codeweavers.com> wrote:

> On Jul 9, 2015, at 7:05 AM, Jonathan Taylor <jonathan.tay...@glasgow.ac.uk> 
> wrote:
>> I gave it a try, setting what I thought should be needed, but it doesn’t 
>> seem to be having the desired effect as yet. I have the nib file set to “Use 
>> autolayout”, and have included the code you quoted.
> 
> Even in a NIB set to use auto layout, top-level views have 
> translatesAutoresizingMaskIntoConstraints turned on.  So, you should turn it 
> off in the NIB on the Attributes inspector or in code after you've loaded it, 
> if the open panel is expected to be auto-layout-savvy.  (In general, 
> actually, one should leave it on and let the code which places the view into 
> a larger hierarchy decide whether to turn it off.  But maybe turning it off 
> will work for this case.  I don't know.)

Interestingly, setting it in the NIB did not go well:
*** Assertion failure in -[NSImageView _didChangeHostsAutolayoutEngineTo:], 
/SourceCache/AppKit/AppKit-1265.21/Layout.subproj/NSView_Layout.m:510
An uncaught exception was raised
Should translate autoresizing mask into constraints if 
_didChangeHostsAutolayoutEngineTo:YES.

I guess as you say the runtime is very keen for me to leave it on!

It’s conceivable that my problem is that I am not doing something important 
related to autolayout (which is new to me), though I am not sure what it could 
be. I am giving the view a low content-hugging priority (“the priority with 
which it RESISTS being made larger/smaller than its intrinsic size”) in case 
that would make any difference (it doesn’t). I have tried both with the text 
control and with an NSImageView (just in case that makes any difference). In 
the imageview case, the intrinsic size of the view is very small, and it is 
very happy to resize itself to the frame rectangle that I have no choice but to 
define for it in IB. However it is utterly refusing to undergo any other 
resizing in order to fill the size of the parent view that it has been inserted 
into in the NSOpenPanel. 

If people weren’t saying that they had managed to get accessory views to resize 
according to the width of the parent view (over which I don’t have control, of 
course), then I’d assume it wasn’t possible. However since it apparently is 
possible I’m tearing my hair out over this, trying to work out what I am 
missing. I don’t suppose anybody knows of any examples that definitely 
demonstrate this working?

Cheers
Jonny
_______________________________________________

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