• 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: When to remove Gesture Recognizers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When to remove Gesture Recognizers


  • Subject: Re: When to remove Gesture Recognizers
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 24 Feb 2016 12:41:14 -0800
  • Feedback-id: 167118m:167118agrif8a:167118sK6fmGD2CU:SMTPCORP

On Feb 24, 2016, at 12:17 , Dave <email@hidden> wrote:
>
> I’m adding a Gesture Recognizer to a view in the awakeFromNIB method. This works ok but I’m getting crashes sometimes and I’m wonder it its because I’m not removing it? If so, when is the best place to call RemoveGestureRecognizer?

I add them in viewWillAppear and remove them in viewDidDisappear (of the relevant view controller, of course). I don’t see any point in adding them when the view loads, since they’re only effective when the view is present in the “live” view hierarchy, hence appear/disappear seems appropriate.

I dunno what anyone else thinks, but in may mind the trend is away from doing anything in awakeFromNIB, if for no other reason than you don’t know for sure how many times it will be called. For things that need to be done after NIB loading, viewDidLoad (or windowDidLoad) seems like a better choice.

_______________________________________________

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


References: 
 >When to remove Gesture Recognizers (From: Dave <email@hidden>)

  • Prev by Date: When to remove Gesture Recognizers
  • Next by Date: Re: UI to allow user to scale and crop image within a circle
  • Previous by thread: When to remove Gesture Recognizers
  • Next by thread: Changing timing for looping uiview animation
  • Index(es):
    • Date
    • Thread