Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

ios - Auto Layout and in-call status bar

I'd like to ask about Auto Layout and in-call status bar. Here's a simple scenario that demonstrates my problem:

  1. Create project with "Use Storyboards" enabled
  2. Add "View Controller" and enable its "Is Initial View Controller"
  3. Set background color of controller's view to red
  4. Add "Table View" into controller's view

The table view should have 4 layout constraints (leading, top, trailing, bottom) to Superview with constant set to 0.

Now when I run this app in Simulator and press ? + T I can see red background while the in-call status bar animates in. Is it possible to get rid of this glitch?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

(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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...