On Feb 24, 2016, at 12:17 , Dave 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 (Cocoa-dev@lists.apple.com)
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com