Thanks very much for your reply. I did wonder if autolayout might make life 
easier - that’s something I haven’t delved into before.

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. Doesn’t seem to have any 
effect. I am loading a nib which contains just an NSTextField, which I have 
given a red background to make it clear what its extent is. As you can see from 
this screenshot, the text field is retaining its shape as defined in the nib 
and is not resizing as I would like it to, to match the size of the parent 
window.
http://imgur.com/aWN4cGU
It may be that I am doing something wrong related to autolayout (although this 
was exactly the problem I was having with non-autolayout as well…). Do you have 
any thoughts about what I might be missing in order for this to behave as I 
would like?

Cheers
Jonny


On 8 Jul 2015, at 22:44, Lee Ann Rucker <lruc...@vmware.com> wrote:

> My accessory views use autolayout and that seems to work fine in 10.9 and up. 
> In 10.8, you need
> 
>  [accessoryView layoutSubtreeIfNeeded];
>  if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_8) {
>     [accessoryView setTranslatesAutoresizingMaskIntoConstraints:YES];
>  }
> 
> 
> 
> On Jul 8, 2015, at 8:33 AM, Jonathan Taylor <jonathan.tay...@glasgow.ac.uk> 
> wrote:
> 
>> I feel this should be a simple question, but I cannot find an answer that 
>> works.
>> 
>> I have an open panel to which I am trying to add an accessory view. That 
>> much works. However I would like the accessory view to resize to fit the 
>> width of the parent window. It’s just a textual description, after all.
>> 
>> An old thread here:
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cocoabuilder.com_archive_cocoa_106875-2Dsetaccessoryview.html&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=ie7S-J__EKnfyVOBV7-jV2rZ--p47O6vkyTklpDM3h4&m=cHbQmyTJpg2XJFwD6Ij_z3NjqhIEgWWn9zXrnGjjOxk&s=MuBFc9loNUfef9MsVOB-rZbhMfX4JwFpjj8iB_S-OzU&e=
>>  
>> suggests this is not trivial to do.
>> 
>> I have tried the suggested monitoring of NSWindowDidResizeNotification (and 
>> also tried NSViewFrameDidChangeNotification), and these don’t seem to work 
>> quite right. There have been plenty of OS changes since that thread was 
>> written, so probably no surprises there.
>> 
>> What happens is that it doesn’t seem possible to *shrink* the Open window (I 
>> guess the ‘hard’ size that I am setting for my view is affecting the minimum 
>> size of the overall window) and, much more alarmingly, I get crashes when 
>> resizing.
>> 
>> The alternative suggestion related to IB struts doesn’t seem to work for me 
>> either. I set all four edge struts and tried both with and without the 
>> ‘resizeable’ arrows in the middle of the view. No effect.
>> 
>> Can anyone advise on the current and correct way of getting the accessory 
>> view to resize appropriately? It seems this should be a common desired 
>> behaviour, but haven’t had any luck doing it or finding any recent 
>> examples/advice on google…
>> 
>> Thanks
>> 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/lrucker%40vmware.com
>> 
>> This email sent to lruc...@vmware.com
> 


_______________________________________________

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