BackButton of NavigationController not showing

I already posted this question, but this time I am posting the code. So I have a uiviewController, and in the viewDidLoad of this viewController, I hide the backButton on the navigationController. After that, I click on the new uiviewcontroller and I set the pad to visible in viewDidLoad, but the lining is still hidden ...

Implementation of the first uiviewcontroller

- (void)viewDidLoad {
    [super viewDidLoad];

    self.navigationItem.title = @"page2page2page2page2page2";

    self.navigationItem.hidesBackButton = TRUE;
}

-(IBAction)click
{
    page3 *controller = [[page3 alloc] init];

    [self.navigationController pushViewController:controller animated:YES];

    [page3 release];
}

Page implementation 3

- (void)viewDidLoad {
    [super viewDidLoad];

    self.navigationItem.title = @"page3";
    self.navigationItem.hidesBackButton = FALSE;

}

and on page 3 there is no lining, but space is created for the button, because the “page 3” tile is on the right and not in the center ... all this happens with ios 4.2

THX

+2
source share
4 answers

, , . , , :

. 2:

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.navigationItem setHidesBackButton:YES animated:YES];
} 

. 3:

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.navigationItem setHidesBackButton:NO animated:YES];
}

self.navigationItem.hidesBackButton = ... .

+1

, , . , , , . , ()

NO pushViewController .

- (IBAction)btnNext:(id)sender {

    [[self navigationController] pushViewController:thirdViewController animated:NO];
}
+2

setNavigationBarHidden YES .

[self.navigationItem setHidesBackButton:NO animated:YES];
[self.navigationController setNavigationBarHidden:YES];
[self.navigationController setNavigationBarHidden:NO];

, backButton , , , P

+2

Well, I had the same issue with iOS 4.2. The back button will not appear. After authoring into the landscape, it appears. My solution was to do the following: this fixed the problem ... or should we say a workaround about this;)

- (void)viewDidLoad 
{
    [super viewDidLoad];
    self.navigationItem.hidesBackButton = YES;
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    self.navigationItem.hidesBackButton = NO;
}
0
source

Source: https://habr.com/ru/post/1779010/


All Articles