KNSemiModalViewController icon indicating copy to clipboard operation
KNSemiModalViewController copied to clipboard

retain cycle problem

Open xuhengfei opened this issue 11 years ago • 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

xuhengfei avatar Aug 27 '13 03:08 xuhengfei

add line objc_setAssociatedObject(modal, kSemiModalPresentingViewController, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); before [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; works for me.

wujichao avatar Jul 26 '16 05:07 wujichao