1.WatchOS View如何全屏。
当我们开发WatchOS App时,会发现WatchOS Status Bar占用Header区域,有时候我们需要把App全屏幕。

可以用.edgesIgnoringSafeArea(.all)
struct XXXXXXXXApp: App { @WKExtensionDelegateAdaptor(ExtensionDelegate.self) var extensionDelegate @Environment(\.scenePhase) var scenePhase @SceneBuilder var body: some Scene { WindowGroup { // !!!Remove any NavigationView and use edgesIgnoringSafeArea and it works!!! // NavigationView { ContentView().edgesIgnoringSafeArea(.all) // } }.onChange(of: scenePhase) { newScenePhase in switch newScenePhase { case .active: print("active") case .inactive: print("inactive") case .background: print("background") @unknown default: print("default") } } WKNotificationScene(controller: NotificationController.self, category: "myCategory") } }
