简体   繁体   中英

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.stack.imgur.com/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)
}

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图片

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM