Re: Changing Subview Order Prevents Dragging
Re: Changing Subview Order Prevents Dragging
- Subject: Re: Changing Subview Order Prevents Dragging
- From: Graham Cox <email@hidden>
- Date: Tue, 14 May 2013 13:34:40 +1000
On 14/05/2013, at 1:14 PM, Roland King <email@hidden> wrote:
> That depends on whether the framework which is calling mouseUp:/mouseDown: retains the object on which it's calling it. If the framework is using ARC and a normal strong reference, then it would be retained and that would stop it deallocing, if it's not using ARC then it depends on whether the framework retains the view explicitly, which it probably should since it's trying to use it but I have no idea whether it does or not.
I'm pretty sure it doesn't, at least between the mouseDown and mouseDragged phases - it may for repeated calls to mouseDragged. I have run into this exact issue in the past.
> Not too hard to test, stick a breakpoint in the dealloc() method and see if it's called from within one of the mouseUp:/mouseDown: methods.
>
> If you are losing it, you can assign self to a strong reference at the start of the method which you nil out again after you've done your window shuffle, and that will hang onto it (as long as it doesn't get optimized out).
Or just do it manually. It's not incompatible with ARC which after all simply inserts the same calls. To my mind, it's clearer what's going on than relying on all those arcane magic pointer types.
--Graham
_______________________________________________
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