而触摸事件被传递到他们发生没有相关的坐标值传送到 的关键窗口, 事件窗口。一次只能有一个窗口成为关键窗口,并且您可以使用窗口的isKeyWindow属性来确定其状态。 大多数情况下,您的应用的主窗口是关键窗口,但UIKit 可能会根据需要指定不同的窗口。 https://developer.apple.com/documentation/uikit/uiwindow为什么我们需要设置keywindow iOS中
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Initialize the window
window = UIWindow.init(frame: UIScreen.mainScreen().bounds)
// Set Background Color of window
window?.backgroundColor = UIColor.whiteColor()
// Allocate memory for an instance of the 'MainViewController' class
let mainViewController = MainViewController()
// Set the root view controller of the app's window
window!.rootViewController = mainViewController
// Make the window visible
window!.makeKeyAndVisible()
return true
}
,我读了,但仍然不明白为什么我们需要一个窗口设置为重要窗口。
而触摸事件被传递到它们发生时的窗口, 事件没有相关的坐标值的关键窗口
交付给 什么让一个窗口的作用关键,它不会发生什么?
由于