「firstView」というタイトルの単純なビューがあります(ViewDidLoad メソッドでこのコードを使用します:)
[self setTitle:@"firstView"
。これにはボタンが 1 つだけ含まれています。このボタンをクリックすると、次のコードのおかげで、アプリに別のビュー ( 「secondView」と呼ばれる) が表示されます。- (IBAction)btnShowAnOtherView:(id)sender { secondView *secondView = [[secondView alloc] initWithNibName:@"secondView" bundle:nil]; [self.navigationController pushViewController:secondView animated:YES]; }
次に、新しいビュー (つまり"secondView" ) は、ナビゲーション バーの戻るボタンのタイトルを"firstView"に自動的に設定します。したがって、すべて正常に動作します。
UITableView を含む「 thirdView 」というタイトルの単純なビュー( ViewDidLoad メソッドでこのコードを使用:
[self setTitle:@"thirdView"
) があります。セルをクリックする と、次のコードのおかげで、アプリは別のビュー ( 「fourthView」と呼ばれる) を表示します。- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { fourthView *fourthView = [[fourthView alloc] initWithNibName:@"fourthView" bundle:nil]; [self.navigationController pushViewController:fourthView animated:YES]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; }
しかし、新しいビュー (つまり"fourthView" ) では、ナビゲーション バーの戻るボタンのタイトルが"secondView"ではなく"Back"に設定されています。なんで ?
ここにサードビューがあります: http://imageshack.us/a/img818/8886/ldp9.png
これが4番目のビューです: http://imageshack.us/a/img33/2444/5y0k.png
ご協力いただきありがとうございます...