ナビゲーション ベースのビュー コントローラーがあり、ビュー コントローラーで上部のナビゲーション バーを非表示にし、カスタム UIView をナビゲーション バーとして使用します。
UIView バーには戻るボタンがあり、Delegate メソッド (プロトコルを宣言しました) を使用して、戻るボタンが押されたときにビュー コントローラーと通信します。
CustomNavigation Bar id デリゲートでデリゲートを使用します。
メインのView Controllerで、ナビゲーションバーを割り当てるときにデリゲートを設定します
topBar = [[TopNavigationBar alloc] initWithFrame:CGRectMake(0, 0, 480, 40)];
topBar.lblTitle.text = @"Shop";
topBar.delegate = self;
ViewControllers の dealloc でこのバーを解放します。
戻るボタンを押すと、デリゲート メソッドを使用して、メインの ViewController で popViewController を呼び出します。
//in Custom Bar
-(void)ButtonPressed {
[delegate TopNavigationBarBackButtonPressed];
}
//In View COntroller
-(void)TopNavigationBarBackButtonPressed {
[self.navigationController popViewControllerAnimated:YES];
}
ViewControllerがポップされ、コントロールは前のviewControllerに移動しますが、ViewControllerとUIViewの両方でdeallocが発生しません
私は何を間違っていますか?