开发者

Hide backbar button in navigationbar in iPhone sdk

In my iPhone App there are three views, firstView, secondView and thirdView.

now I want to put Back Button in navig开发者_StackOverflow社区ation bar in thirdView only which should take me to back secondView only

for that i m writing this code in first view

self.navigationItem.hidesBackButton:NO;

and it shows the back button in both the views secondView and thirdView

what I should do to hide back button in the the secondView?


I think you have to set [self.navigationItem setHidesBackButton:YES] in your secondView. And set [self.navigationItem setHidesBackButton:NO] in your thirdView.


-(void)viewWillAppear:(BOOL)animated{

    [super viewWillAppear:animated];

    self.navigationItem.backBarButtonItem=nil;

}
OR
-(void)viewWillAppear:(BOOL)animated{

    [super viewWillAppear:animated];

    self.navigationItem.hidesBackButton=YES;

}


To hide the back button in the navigation bar

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

    self.navigationController.navigationBar.topItem.hidesBackButton = YES;
}

To show the back button in the navigation bar

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

    self.navigationController.navigationBar.topItem.hidesBackButton = NO;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜