Closed ussu99 closed 3 years ago
Thanks for the suggestion, and sorry it took so long for me to get on this!
So what are the effects of not removing the label as an observer? The label does check if window
is nil in the labelReadyForScroll()
function before starting a scroll animation, so the notifications shouldn't attempt to fire off animations without a window. Also the class functions that trigger the notifications require the controller to be passed in, and if the label has been removed from a window and responder chain I don't think it will "match" on the passed-in controller (but that may not always be true if you have multiple view controllers in the hierarchy).
If the label is being otherwise retained but has been removed from the window, from my (admittedly limited) testing it seems like there's basically no effect. If the label is subsequently re-added to a window, we would need a way to also re-subscribe to the Notification Center. Certainly doable, but would require changing up when the label subscribes in the code.
Closing this due to inactivity.
Usage Details
Expected Behavior
Function didMoveToWindow should Remove from Notification center if window is nil!
Suggested Code
Currently deinit is never called and therefore no remove from NotificationCenter occurs.