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 12:41:18 +1000
On 14/05/2013, at 12:27 PM, Thomas Wetmore <email@hidden> wrote:
> Can anyone suggest why adding the three lines in mouseDown prevents dragging? Using ARC.
When you call -removeFromSuperview, the view is deleted, as there are no more references to it. The other methods are not called because the object ceases to exist.
You need to retain it, remove it, add it to the superview then release it. ARC won't automatically help you out in this case because you're deallocing self, indirectly, which is not a good idea.
[self retain];
[self removeFromSuperview];
[superview addSubview:self];
[self release];
--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