我正在学习如何创建一个不使用Interface Builder(即故事板、xib等)的iOS应用程序。以下是我正在使用的基本应用委托类。问题在于,当UIWindow
被显示时,它没有占满设备屏幕的整个区域(请参见附带的截图)。这种情况发生在我测试的所有设备和模拟器上。为什么不使用全屏?
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var window: UIWindow? = {
debugPrint("AppDelegate: Creating Window")
let screen: UIScreen = UIScreen.mainScreen()
let window: UIWindow = UIWindow.init(frame: screen.bounds)
window.backgroundColor = UIColor.whiteColor()
return window
}()
lazy var rootViewController: ShapesViewController = {
debugPrint("AppDelegate: Creating Root View Controller")
let rootViewController = ShapesViewController.init(nibName: nil, bundle: nil)
return rootViewController
}()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
debugPrint("AppDelegate: applicationWillEnterForeground")
window?.rootViewController = rootViewController
window?.makeKeyAndVisible()
return true
}
}
Launch screen interface file base name
键表明您的应用程序原生地运行在更新的设备类型上,例如iPhone 6和iPhone 6 Plus。如果没有它,您的应用程序将被缩放显示...您将无法获得所有应得的像素... - Basil Bourque