nick shmick nick shmick - 1 year ago 44
iOS Question

'Back' button is not appearing after performing push segue

I', performing a basic push segue (working with nibs) and from one view controller to another table view controller, and from some reason the 'Back' button is not appearing, that normally it does appear.

This is how i'm performing the push:

@interface HomeViewController ()

@end

@implementation HomeViewController

- (id)init {
self = [super initWithNibName:@"HomeViewController" bundle:nil];
if (self) {
// Do something
}
return self;
}

- (void)viewDidLoad {

[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}

- (IBAction)goToStack:(id)sender {

StackTableViewController *stackViewController = [[StackTableViewController alloc] initWithNibName:@"StackTableViewController" bundle:nil];
[self.navigationController pushViewController:stackViewController animated:YES];
}

Answer Source

In your StackTableViewController, you should set setNavigationBarHidden to NO

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}