我创建了一个非常简单的UINavigationController应用程序。不使用IB,仅创建两个文件AppDelegate.swift和ViewController.swift。但是结果看起来很奇怪。请检查附件图片
我使用XCode 10.2.1。模拟器的屏幕无法完全填充,并且iphone8模拟器的状态栏放置在错误的位置。
AppDelegate.swift:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.main.bounds)
let homeVC = ViewController(nibName: nil, bundle: nil)
homeVC.title = "HOME"
let nav = UINavigationController(rootViewController: homeVC)
self.window?.rootViewController = nav
self.window?.makeKeyAndVisible()
return true
}
ViewController.swift:
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.yellow
// Do any additional setup after loading the view.
}
我怎么了?