How to hide the navigation Bar in the first Viewcontroller iOS swift?

Solution:

If you want to hide the navigation bar in the first screen only then you must want to hide the navigation bar in the first screen and show the navigation bar in all the screens.You can add the below code in the first ViewController is the best solution.Otherwise no of lines will be increased.

Objective C:

- (void)viewWillAppear:(BOOL)animated {
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}

Swift:

override func viewWillAppear(animated: Bool) {
self.navigationController?.navigationBar.isHidden = true
}

override func viewWillDisappear(animated: Bool) {
self.navigationController?.navigationBar.isHidden = false

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift