I have a Navigation based view controller and in the view controller i have hidden the top navigation bar and use a custom UIView as the navigation bar.
The UIView bar has a back button and I use Delegate methods(I have declared a protocol) to communicate to the view controller when the back button is preesed.
I use delegate in my CustomNavigation Bar id delegate;
and In the main View Controller when i allocate the navigation bar i set the delegate
topBar = [[TopNavigationBar alloc] initWithFrame:CGRectMake(0, 0, 480, 40)];
topBar.lblTitle.text = @"Shop";
topBar.delegate = self;
I release this Bar in the ViewControllers dealloc.
Now when i press the back button I use delegate method to call a popViewController in the main ViewController.
//in Custom Bar
-(void)ButtonPressed {
[delegate TopNavigationBarBackButtonPressed];
}
//In View COntroller
-(void)TopNavigationBarBackButtonPressed {
[self.navigationController popViewControllerAnimated:YES];
}
Now the ViewController is poped and the control goes to the previous viewController but the dealloc is not fired in both the ViewController and the UIView
What am i doing wrong?