selvavignesh
selvavignesh

Reputation: 27

How to remove white space of the tab bar controller

I have added tab bar controller to my view controller, a white space is visible in the top of my view. I have tried to set my navigation bar visible to false in viewwillappear function, it didn't work. I have unchecked under bar in extended edges, that didn't work either. Someone please guide me through this problem.

My Storyboard https://i.sstatic.net/SxOYH.png

SceneDelegate.swift

    guard let winScene = (scene as? UIWindowScene) else { return }
    window = UIWindow(windowScene: winScene)
    let storyboard = UIStoryboard(name: "Home", bundle: nil)
    let initialViewController = storyboard.instantiateViewController(identifier: "TabBarController")
    let navController = UINavigationController(rootViewController: initialViewController)
    window?.rootViewController = navController
    window?.makeKeyAndVisible()

HomeVC.swift

override func viewWillAppear(_ animated: Bool) {
  super.viewWillAppear(animated)
  self.navigationController?.setNavigationBarHidden(true, animated: true)
}

Upvotes: 0

Views: 379

Answers (1)

agha Shahriyar
agha Shahriyar

Reputation: 89

Click your navigation controller, select attribute inspector at the right side of Xcode. unselect show navigation bar option in the navigation controller section as shown in image image

Upvotes: 1

Related Questions