I have a problem in one of my VCs called ArticleViewController
. The dealloc
method is never called, and when the view is opened and closed three times, there are three VCs alive.
I read here (great source when you have a retain cycle in your ViewController!) the following:
If you use
someObj.delegate = self;
inside the view controller, check the delegate property on
someObj
isweak
.@property (nonatomic, weak) id delegate;
One of the snippets in my VC is:
PopViewController *pop=[[PopViewController alloc] initWithNibName:@"PopViewController" bundle:nil];
pop.delegate = self;
So I check in PopViewController.h
if the property is weak.
@property (nonatomic, assign) id <PopViewControllerDelegate> delegate;
Since strong
is the default, and there is no explicit weak
here, would this cause my retain cycle? I am bit in doubt, because I see the same thing in the header file of e.g. UIPopoverController.h
, which is in the UIKit.
@property (nonatomic, assign) id <UIPopoverControllerDelegate> delegate;