Re: How to resize accessory view to match Open panel
Re: How to resize accessory view to match Open panel
- Subject: Re: How to resize accessory view to match Open panel
- From: Lee Ann Rucker <email@hidden>
- Date: Wed, 08 Jul 2015 21:44:54 +0000
- Thread-topic: How to resize accessory view to match Open panel
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 <email@hidden> 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 (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