iOS 8 Launch Image File - Navigation Bar and the S

2019-04-19 20:13发布

I'm using Interface Builder to make the launch image file for iOS 8. The launch image that I want is very simple (same as the Settings app, I think) - Navigation Bar at the top with an empty, Grouped TableView. No title, etc.

Note, I don't normally use Interface Builder - so the IB thing is completely new to me.

I'm trying to achieve this by adding a Navigation Bar and Table View to the View - and then setting up the constraints. The constraints (and colours) are working fine, but...

The problem: the launch image displays full screen, over the status bar. Like this:

enter image description here

How do I get both the status bar and the navigation bar?

Like I said, I'm working with the default 'UIView' you get when you select to add a Launch Screen in Xcode. So there isn't a Navigation Controller; is that the problem?

Additionally, there are some options on the UIView that seem like they should give me what I want:

enter image description here

I've tried playing around with the Status Bar options, but it's not quite working.

  • Do I need Inferred or Default?
  • I'm seeing a small offset between the launch image (status bar + navigation bar) and the actual app running, have I just positioned it incorrectly?
  • What's the purpose of the Top Bar option?
  • For the launch image that I want, do I even need to add a TableView as a subview, or can I use the background colour on the main UIView? I've tried that but then I get a mismatch of colours with the status bar / navigation bar...

For an Interface Builder noob, how do I create a launch screen file that replicates that of the Settings app?

1条回答
Anthone
2楼-- · 2019-04-19 21:09

If you are using a storyboard file, you could set your view as the root view in a Navigation Controller Scene. A Navigation Controller's navigation bar automatically positions itself below the status bar.

Example

Don't forget to set the Navigation Controller as the initial view controller (by checking Is Initial View Controller in the property pane)

A Navigation Controller Scene automatically adds a table view controller as it's nested controller when you add it to the storyboard.

If you want to replace it with another controller, you'll have to remove the table view controller from the storyboard, add the controller you want to use to the storyboard and then hook it up (by command+dragging from the navigation controller to the view controller and then selecting the rootViewController outlet)

NOTE Objects (viewcontrollers etc.) in a launch screen storyboard should not have have any IBOutlets set. This will lead to errors.

查看更多
登录 后发表回答