• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Changing Subview Order Prevents Dragging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Changing Subview Order Prevents Dragging
      • From: Quincey Morris <email@hidden>
    • Re: Changing Subview Order Prevents Dragging
      • From: Roland King <email@hidden>
References: 
 >Changing Subview Order Prevents Dragging (From: Thomas Wetmore <email@hidden>)

  • Prev by Date: Changing Subview Order Prevents Dragging
  • Next by Date: ImageKit questions
  • Previous by thread: Changing Subview Order Prevents Dragging
  • Next by thread: Re: Changing Subview Order Prevents Dragging
  • Index(es):
    • Date
    • Thread