मैंने स्क्रीन को टैप करते समय नेविगेशन बार (शीर्ष बार) दिखाई/गायब कर दिया, और पृष्ठभूमि छवि के शीर्ष पर भी रखा। यह काम किया, लेकिन एक समस्या के साथ: मुझे अचानक दो नेविगेशन बार मिल गए हैं! सबसे पहले, "बैक" नामक बैक बटन वाला एक, और जब मैं "बैक" दबाता हूं तो यह "विनीन" नामक बैक बटन के साथ एक नई नेविगेशन बार पॉप अप करता है, जो टेबलव्यू का शीर्षक है, जो इसे वापस ले जाता है। मैं वह रखना चाहता हूं जो मैं रखना चाहता हूं। मुझे लगता है कि यह समस्या DetailViewController.m में या MasterViewController.m में didselectrowatindexpath में कहीं है। उम्मीद है कि कोई समस्या देख सकता है!अनचाहे डबल नेविगेशन बार
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];
}
}
पोस्ट तस्वीर कृपया – Legolas