Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible use UINavigationController but hide its navigation bar (replace it with customized toolbar) and go back button

Tags:

iphone

I hope to switch between 2 UIViewController using UINavigationController. (AUIViewController, BUIViewController relate to UIView AView,BView)

AView has an UIButton, BView has an UIButton also. If I press the button on AView, it will push BViewController and display BView. If I press the button on BView, BViewController will pop and go back AUIViewController.

I hope to use UINavigationController's navigation function but hide its 'go back' bar and navigation bar, only use 2 buttons to tell UINaviationController what it needs to do. Is it possible?

like image 842
arachide Avatar asked Dec 20 '10 11:12

arachide


People also ask

How do I hide the navigation bar back button in Swift 5?

Way 1: Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.

How do I hide the top navigation bar in Swift?

To hide the navigation bar in Swift, you'll need to add code to two methods: viewWillAppear and viewWillDisappear . That's it to hide the navigation bar in your view controller.


1 Answers

to hide UINavigationController's navigation bar:

[self.navigationController setNavigationBarHidden:YES];

To push a view controller from a button:

- (void)pushNextViewController {
    NextViewController *page = [[NextViewController alloc] initWithNibName:nil bundle:nil];
    [self.navigationController pushViewController:page animated:YES];
}

To pop a view controller back one:

- (void)popToLastViewController {
    [self.navigationController popViewControllerAnimated:YES];
}
like image 199
Thomas Clayson Avatar answered Oct 10 '22 01:10

Thomas Clayson