retain cycle problem
xuhengfei opened this issue · 1 comments
what does line mean in UIViewController+KNSemiModal.m
objc_setAssociatedObject(view, kSemiModalPresentingViewController, self, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
I create myView and make self(UIViewControler) strong ref to myView
When I pop View by presentSemiView:(UIView*)view
That line will mak myView strong ref with self(UIViewController)
When I dismiss ,myView will not remove this strong ref
This make myView strong ref to self(UIViewController)
and self(UIViewController) strong ref to myView
It make retain cycle.
Is this a bug?
or something wrong with my usage?
Thank you
add line
objc_setAssociatedObject(modal, kSemiModalPresentingViewController, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
before
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
works for me.