I am trying to tune my project after moving to ARC. My biggest problem is at the moment that objects are not released because of circular references. E.g. on an UIView the dealloc is not called (which I previously used to release objects and put them on nil, because those objects are preventing the dealloc.
For UIViews I can do some logic on 'ViewDidDisappear' and decide f it is not needed anymore, but now I have a problem with UITableViewCells. In one I have an Notification observer, and the cell stays in memory if the observer is created.
What would be the best way to detect if an instance of (e.g.) the UITableViewCell is not needed anymore so I can remove the observer and the object can release itself from memory?
This is my header:
@interface DOArticleListCell : DOPrototypeCell {
IBOutlet UILabel *_title;
IBOutlet UILabel *_summary;
IBOutlet UILabel *_site;
IBOutlet UILabel *_update;
IBOutlet UILabel *_unpublished;
IBOutlet UIButton *_readButton;
__weak DOArticle *_article;
NSNumber* _isEditor;
}
@property (nonatomic, weak) DOArticle *article;
- (void)updateReadButton;
- (IBAction)toggleReadButton:(id)sender;
@end
(The prototype cell just has one function called 'populateCell'.)
Ps. I need the observer to update the 'read' label when the detailViewController being called when the cell is selected is opened.