Posts

Post not yet marked as solved
14 Replies
Sorry,I tried the run as DaleOne's suggestion on iOS13.2.2 as shown below. I got the same gap between navigation controller and View Controller problem. (My iOS is 13.2) override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) print("In viewWilAppear") if #available(iOS 13.0, *){ navigationController?.navigationBar.setNeedsLayout() print("iOS 13.0, *") } else { print("else") } }As the time I change replace the ? to ! as shown below.navigationController!.navigationBar.setNeedsLayout()I got the following error.Unexpectedly found nil while unwrapping an Optional value: file /Users/angela_m_li/Desktop/GapInViewController/GapInViewController/ViewController.swift, line 19It seems like it the above line will have nil result and so it will not be executed.Is it any other suggestion to get rid of the gap?