Re: Auto Layout and Resizable NSViews
Re: Auto Layout and Resizable NSViews
- Subject: Re: Auto Layout and Resizable NSViews
- From: Thomas Wetmore <email@hidden>
- Date: Mon, 20 Jul 2015 20:13:57 -0400
Ken,
Thank you! The lights are coming on. Things can become quite obvious when they become obvious, can’t they?
Tom Wetmore
> On Jul 20, 2015, at 5:13 PM, Ken Thomases <email@hidden> wrote:
>
>> On Jul 20, 2015, at 3:30 PM, Thomas Wetmore <email@hidden> wrote:
>>
>> I would really like to be able to do resizing using a mouse event loop, but have the layout constraints somehow involved. Reading through references for NSView I don’t see how to do this. I guess I am looking for a way from within the event loop to be able to check whether a proposed new frame rectangle for the view obeys the view’s size constraints.
>
> What you should do when using auto layout is place and size the view using constraints. Thus moving the view involves modifying the placement constraints and resizing the view involves modifying the size constraints. For the size constraints, they should be lower priority than your minimum-size constraints (if you want to keep those separate). Therefore, no matter what the drag-tracking code does to those size constraints, your view still won't go below the minimum size. Of course, a reasonable alternative is to just use the one set of size constraints and, in your code, disallow ever setting them below your minimums. You'll have to do something like that, anyway, to prevent the size constraint constants from going negative, since that's not allowed.
>
> You should avoid using any of the -setFrame… methods. I assume that's what you have been using to place and size the view, but frames set that way get overridden by the next layout pass.
>
> Regards,
> Ken
>
_______________________________________________
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