Ios 导航栏中的问题未隐藏在其他视图控制器中
我在应用程序委托中使用此代码将Ios 导航栏中的问题未隐藏在其他视图控制器中,ios,uinavigationbar,Ios,Uinavigationbar,我在应用程序委托中使用此代码将BreatDateTableViewController作为rootview控制器 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { name =[[NSString alloc]init]; birthdate =[[NSString alloc]init]; phon
BreatDateTableViewController
作为rootview控制器
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
name =[[NSString alloc]init];
birthdate =[[NSString alloc]init];
phone =[[NSString alloc]init];
email =[[NSString alloc]init];
image =[[NSString alloc]init];
birthDateTableViewController =[[BirthDateTableViewController alloc]initWithNibName:@"BirthDateTableViewController" bundle:nil];
navController1 = [[[UINavigationController alloc]initWithRootViewController:birthDateTableViewController]autorelease];
[window addSubview:navController1.view];
[window makeKeyAndVisible];
[FBProfilePictureView class];
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque];
self.databaseName = @"birthdateDatabase.sqlite";
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentDir = [documentPaths objectAtIndex:0];
self.databasePath = [documentDir stringByAppendingPathComponent:self.databaseName];
[self createAndCheckDatabase];
// sleep(5);
if (sqlite3_open([[self dataFilePath] UTF8String], &database1) != SQLITE_OK)
{
sqlite3_close(database1);
NSLog(@"Failed to open db.");
}
else
NSLog(@"Open DB");
return YES;
}
因此,为了解决这个问题,我尝试删除导航栏,并将以下代码放到brithdatetableviewcontroller
中,使其成为根视图控制器
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.birthDateTableViewController = [[BirthDateTableViewController alloc] initWithNibName:@"BirthDateTableViewController" bundle:nil];
self.window.rootViewController = self.birthDateTableViewController;
[self.window makeKeyAndVisible];
但当我使用它时,它会进入brithdatetableviewcontroller,但不能正常工作
所以,让我们继续我以前做过的事情,我如何做一些事情,比如Nevigation bar在rootview中显示,但当它进入另一个viewcontroller时应该隐藏,而那些viewcontroller有自己的nevigationbar和按钮
我试图将它隐藏在另一个viewcontroller中,但这在这里不起作用
请建议我应该做什么来处理这个问题?在viewController中
- (void)viewWillAppear:(BOOL)animated
{
// If you wnat Navigation Bar then
[self.navigationController setNavigationBarHidden:NO];
// Else if you don't want
[self.navigationController setNavigationBarHidden:YES];
}
我试过了,它不起作用。使用此[self.navigationController setNavigationBarHidden:YES];对于隐藏但什么都没有发生我有一个问题它会隐藏主导航栏还是只隐藏所有导航栏?