forked from tomknig/TOMSMorphingLabel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Break the strong reference cycle between CADisplayLink and TOMSMorphi…
…ngLabel. CADisplayLink retains the object set as its target and TOMSMorphingLabel references the display link strongly. This gives a strong reference cycle and TOMSMorphingLabel is never deallocated. This commit adds a helper class named TOMSMorphingLabelWeakWrapper which holds a weak reference to the label and forwards necessary messages to it. This breaks the reference cycle and allows deallocating the label. Note that if the weak wrapper's label reference gets nullified due to the label being deallocated, the display link would continue firing its events to the weak wrapper. So it is necessary to properly invalidate the display link in the TOMSMorphingLabel's dealloc.
- Loading branch information
1 parent
3bb1a66
commit d181a01
Showing
1 changed file
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters