而觸摸事件被傳遞到他們發生沒有相關的座標值傳送到 的關鍵窗口, 事件窗口。一次只能有一個窗口成爲關鍵窗口,並且您可以使用窗口的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
}
,我讀了,但仍然不明白爲什麼我們需要一個窗口設置爲重要窗口。
而觸摸事件被傳遞到它們發生時的窗口, 事件沒有相關的座標值的關鍵窗口
交付給 什麼讓一個窗口的作用關鍵,它不會發生什麼?
由於