In Call Status Bar (Unable to Satisfy Constraints)

Auto Layout and in-call status bar

(Using answer instead of comment due to lack of reputation, sorry.)

I ran into this issue as well and was trying out e.g. the solution pointed out above: It didn't work for me.

So I created a repository with example code to expose the original poster's problem. There are example applications for these scenarios:

  1. the Custom View Controller is the window's root view controller,
  2. the Custom View Controller is a child of a UINavigationController which is the window's root view controller,
  3. the Custom View Controller is a child of a UITabBarController which is the window's root view controller and
  4. the Custom View Controller is a child of a UINavigationController which is as child of a UITabBarController which is the window's root view controller.

It turned out that the solution from CEarwood actually works… when the custom view controller is a child of a UINavigationController (cases 2 and 4). Hoewever, it does not work in cases 1 and 3.

I hope this information is useful.

Custom container does not adjust correctly layout to in-call status bar

After playing around I was able to determine that there was a problem with the frame being set - the frame of the container view controller seemed to be offseted but not resized when the initialTransition(to:) was called (in container's viewDidLoad), thus causing the child the get a frame that overlapped the bottom of the screen by the offset - 20 points.

My first approach was to add setting the frame once again in container's viewDidAppear, which in the end solved the problem, but cause a glitch - for a moment the bottom seemed cropped, and then viewDidAppear was called and the layout was adjusted correctly. This glitch looked bad.

I finally achieved what I wanted by overriding container's viewDidLayoutSubviews and setting the frame of the child there (thus when the container gets notified to adjust its frame to the status bar, the information about a new frame gets passed to the child).

override func viewDidLayoutSubviews() {
self.selectedViewController?.view.frame = self.view.frame
super.viewDidLayoutSubviews()
}

Unable to simultaneously satisfy constraints iOS

It's obvious you're using SnapKit. makeConstraints add constraints to an existing one.

To update existing constraint you should use updateConstraints, but you should to anchor to same point,

ex: .equalToSuperview().inset(0) and .equalToSuperview().inset(keyboardHeight)

If there is no option to anchor to same point, you should clear previous constraints and make some new. You can do it simultaneously using .remakeConstraints , but you should add all other constraints, like leading, trailing, top

iOS Status Bar Height Incorrect when In a Call

In your main view controller, where your tab bar controller lives, make sure you override viewDidLayoutSubviews() and resize the UITabBarController as such:

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
self.myTabViewController.view.frame = self.view.bounds
}


Related Topics



Leave a reply



Submit