I have some problem with my singleton and UIViewController there;
Singleton.h
@property (nonatomic, retain) UIViewController *viewController;
Singleton.m
...
@synthesize viewController = _viewController;
- (void)load {
self.viewController = [[[UIViewController alloc] initWithNibName:@"NibName" bundle: nil] autorelease];
}
- (void)unload {
[_viewController release];
}
This viewController
using by different part of the application via pushViewController:animated:
. But sometimes I need to release viewController
by calling method - (void)unload
of Singleton class! If pushViewController:animated:
never call for viewController
everything is well and dealloc is calling, but if pushViewController(and viewController perform viewDidLoad), dealloc isn't work. If I do something like self.viewController = nil;
dealloc calling twice... What I'm doing wrong???