テーブルの編集中に [戻る] ボタンを非表示にする if ステートメントを作成しました。
しかし、編集モードを終了すると、戻るボタンが再び表示されません。
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
NSLog(@"Edit");
bool e = [tableView isEditing];
e=!e;
[tableView setEditing:e animated:YES];
[super setEditing:e animated:YES];
if (editing)
{
[self.navigationItem setHidesBackButton:YES animated:NO];
UIBarButtonItem *add = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(pushViewController:animated:)];
self.navigationItem.leftBarButtonItem = add;
}
else if (editing == false)
{
self.navigationItem.leftBarButtonItem = self.navigationItem.backBarButtonItem;
//[self.navigationItem setHidesBackButton:NO animated:NO];
}
}
NSLog を else ステートメントに追加しましたが、まったく呼び出されていないようです。
編集:私はそれを解決しました.if(editing == true)をif(e == true)に置き換えただけですが、すべての助けに感謝します.