0

I'm writing an application for iOS with Swift and I'm using the auto layout in all my View Controllers but When the personal Hotspot is activated, the view doesn't resize correctly and The bottom of the view goes below the screen. I found It doesn't happen to my all views, except in the views that I have this line of code:

navigationController?.navigationBar.isHidden = true

How can I handle this situation?

M Reza
  • 18,350
  • 14
  • 66
  • 71
Hasti Ranjkesh
  • 643
  • 10
  • 26

1 Answers1

0

I found a solution. I always have this problem when I add a child view controller and the bottom of the child view goes below the screen. I found when the blue bar appears, the height of my parent view controller will be lower than the device screen's height. So I need to change the child view position in the situation.

 if let parentHeight = parent?.view.frame.height, parentHeight < UIScreen.main.bounds.height {
        view.frame.origin.y = UIScreen.main.bounds.height-childViewHeight-8
 } 
Hasti Ranjkesh
  • 643
  • 10
  • 26