Я пытаюсь получить своего рода иерархическую навигацию "слева направо" с помощью UINavigationController. Я использую этот код:
-(IBAction)showSettings:(id)sender {
UINavigationController *aNavController = [[UINavigationController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:aNavController animated:YES];
SecondView *secondView = [[SecondView alloc] initWithNibName:nil bundle:nil];
[aNavController pushViewController:secondView animated:NO];
UIBarButtonItem *aButton = [[UIBarButtonItem alloc] initWithTitle:@"Knapp" style:UIBarButtonItemStylePlain target:self action:@selector(nextView:)];
aNavController.topViewController.navigationItem.rightBarButtonItem = aButton;
[aButton release];
[secondView release];
[aNavController release]; }
-(IBAction)nextView:(id)sender {
ThirdView *thirdView = [[ThirdView alloc] initWithNibName:nil bundle:nil];
[self.navigationController pushViewController:thirdView animated:YES];
NSLog(@"Push it like it's hot"); }
'nextView' вызывается правильно, "Push it as hot hot" печатается в "Output", но ничего не нажимается, новый вид не отображается. Я также попытался изменить:
[self.navigationController pushViewController:thirdView animated:YES];
до [self.navigationController popViewControllerAnimated:YES];
, но результат остается прежним, ничего не происходит.
Мой вывод такой: я делаю что-то не так в части self.navigationController 'nextView', т. Е. Программа не знает, из / в чего нажать / выдвинуть. Я сделал все возможное, чтобы посмотреть какую-то документацию по этому вопросу, но я не могу разобраться, так что я здесь.
Является ли self.navigationController правильным способом сделать это или я что-то упустил в этой строке?
Спасибо заранее,
Тобиас Товедал