导航栏在iphone中丢失

时间:2012-02-16 15:08:15

标签: iphone ios debugging uinavigationcontroller

我是iPhone开发的新手,但我已经获得了一个iPhone应用程序来调试,我不知道从哪里开始。

问题如下:

该应用的视图顶部有导航栏。当我按下设备上的主页按钮时,我认为应用程序进入挂起模式。当我从列表中返回应用程序时,我可以看到视图,但没有导航栏。为什么导航栏会消失,我该如何解决?

以下是相同

的代码
-(void)viewWillAppear:(BOOL)animated
{

    [self prepareNavBar];
}



-(void)prepareNavBar
{
     self.navigationItem.hidesBackButton = NO;

    CustomNavBar *the_pNavBar = [[CustomNavBar alloc] init];
    [the_pNavBar prepareNavbarWithLeftButtonImage:nil leftButtonAction:nil titleImage:    [UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath]     stringByAppendingPathComponent:@"ip4_heading_comments.png"]] rightButtonImage:[UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"ip4_submit.png"]] rightAction:@selector(postComment) target:self backgroundImage:[UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"ip4_background_grey_150px.png"]] navigationBar:self.navigationController.navigationBar isStandardNavBar:NO];
[the_pNavBar release];

}

如果需要任何其他代码,请告诉我

1 个答案:

答案 0 :(得分:0)

我通过以下代码解决了问题

-(void)didBecomeActive:(NSNotificationCenter *)in_pNotif
{
    [self performSelector:@selector(test) withObject:nil afterDelay:0.01];
}

-(void)test
{
    self.navigationController.toolbarHidden = YES;
}