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:23:37 -0400
> On Jul 20, 2015, at 7:53 PM, Quincey Morris <email@hidden> wrote:
>
> On Jul 20, 2015, at 16:41 , Thomas Wetmore <email@hidden> wrote:
>>
>> Here is the mouse-down method with event loop. As you can see I am calling setFrameOrigin in the dragging case and setting frame directly in the resizing case.
>
> So I think you need to retool your thinking. With auto layout, you no longer change the size or position of views, but rather change the constraints that are applied to those view, as Ken Thomases explained in his post.
>
> As a side issue, given that you’ll need to update constraints and re-layout your view hierarchy every time the mouse moves during a drag, it might be worthwhile retooling your code to use mouseDown/mouseDragged events non-modally, instead of using your current modal loop.
I am worried about the performance implications of this. Should I not be? Implementation will tell, of course.
I have gone back and forth between the modal approach and the “three-method” approach a couple times. I am now using the modal approach because it resulted in much smoother dragging and resizing. But I have recently upgraded to a new iMac Retina, with much faster processor; I’ll shift back to the three methods when I put in the fix.
Tom Wetmore
_______________________________________________
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