Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retain cycle problem #53

Open
xuhengfei opened this issue Aug 27, 2013 · 1 comment
Open

retain cycle problem #53

xuhengfei opened this issue Aug 27, 2013 · 1 comment

Comments

@xuhengfei
Copy link

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

@wujichao
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants