Unerwünschte doppelte Navigationsleiste

Ich habe die Navigationsleiste (obere Leiste) beim Tippen auf den Bildschirm ein- bzw. ausgeblendet und mich über das Hintergrundbild gelegt. Es hat funktioniert, aber mit einem Problem: Ich habe plötzlich zwei Navigationsleisten! Erstens, eine mit einem Zurück-Button namens "Zurück", und wenn ich "Zurück" drücke, öffnet sich eine neue Navigationsleiste mit einem Zurück-Button namens "Vinene", dem Titel der TableView, zu der es zurückführt. Das ist die, die ich behalten möchte. Ich denke, das Problem liegt irgendwo in der DetailViewController.m oder in der didselectrowatindexpath in der MasterViewController.m. Hoffe, jemand kann das Problem sehen!

DetailViewController.m:

@interface WinesDetailViewController ()

@end

@implementation WinesDetailViewController

@synthesize wineDictionary;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

}

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.

self.navigationController.navigationBar.translucent = YES;
                         self.wantsFullScreenLayout = YES;

UITapGestureRecognizer *tap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideShowNavigation)] autorelease];
                                                                                                         tap.numberOfTapsRequired = 1;
                                                                                                 [self.view addGestureRecognizer:tap];
}

- (void) hideShowNavigation
{
[self.navigationController setNavigationBarHidden:!self.navigationController.navigationBarHidden];
}

- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (BOOL)hidesBottomBarWhenPushed{
return TRUE;
}


@end

MasterViewController.m:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
    {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];    

    NSDictionary *dictionary = [wine libraryItemAtIndex:indexPath.row];

    if (winesDetailViewController == nil) {
        // Init the wine detail view
        winesDetailViewController = [[WinesDetailViewController alloc] init];
    }
    // Here you pass the dictionary
    winesDetailViewController.wineDictionary = dictionary;

    [self.navigationController pushViewController:winesDetailViewController animated:YES];
    }
}

Antworten auf die Frage(1)

Ihre Antwort auf die Frage