UIApplication 的 keyWindow
程序员文章站
2024-01-15 08:01:58
...
@property(nullable, nonatomic,readonly) UIWindow *keyWindow
API_DEPRECATED("Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes", ios(2.0, 13.0));
AppDelegate.window
== [[UIApplication sharedApplication] keyWindow]
== [[UIApplication sharedApplication] windows][0]
需要在window上添加视图时,可以使用
UIWindow *window = [[UIApplication sharedApplication] windows][0];
上一篇: helloword
下一篇: Cocoa代码风格指南之命名规范(一)