{"id":1129,"date":"2020-10-10T15:56:49","date_gmt":"2020-10-10T07:56:49","guid":{"rendered":"http:\/\/123.57.164.21\/?p=1129"},"modified":"2020-10-10T15:56:49","modified_gmt":"2020-10-10T07:56:49","slug":"swiftui-%e4%bf%ae%e6%94%b9status-bar%e9%a2%9c%e8%89%b2","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=1129","title":{"rendered":"SwiftUI \u4fee\u6539Status Bar\u989c\u8272"},"content":{"rendered":"\n<p>\u6709\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539App\u7684\u72b6\u6001\u680f\u989c\u8272\uff0c\u5728SwiftUI\u4e2d\uff0cUIHostingController\u6240\u6709view\u7684\u6839\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539UIHostingController\u6765\u6539\u53d8\u989c\u8272\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class MyHostingController&lt;ContentView>: UIHostingController&lt;ContentView> where ContentView : View {\n    override var preferredStatusBarStyle: UIStatusBarStyle {\n        return .lightContent\n    }\n}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import UIKit\nimport SwiftUI\nimport VitalSign\n\nclass SceneDelegate: UIResponder, UIWindowSceneDelegate, VSSensorManagerDelegate, VSMonitorDelegate {\n\n    var window: UIWindow?\n    var sensorManager: VSSensorManager!\n    var monitor: VSMonitor!\n\n\n    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {\n        \/\/ Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.\n        \/\/ If using a storyboard, the `window` property will automatically be initialized and attached to the scene.\n        \/\/ This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).\n\n        \/\/ Create the SwiftUI view that provides the window contents.\n        let contentView = ContentView()\n\n        \/\/ Use a UIHostingController as window root view controller.\n        if let windowScene = scene as? UIWindowScene {\n            let window = UIWindow(windowScene: windowScene)\n            window.rootViewController = MyHostingController(rootView: contentView)\n            \n            self.window = window\n            window.makeKeyAndVisible()\n        }\n    }\n<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2020\/10\/image-9.png\" alt=\"\" class=\"wp-image-1133\" width=\"570\" height=\"99\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2020\/10\/image-9.png 744w, https:\/\/92it.top\/wp-content\/uploads\/2020\/10\/image-9-300x52.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2020\/10\/image-9-230x40.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2020\/10\/image-9-350x61.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2020\/10\/image-9-480x84.png 480w\" sizes=\"(max-width: 570px) 100vw, 570px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539App\u7684\u72b6\u6001\u680f\u989c\u8272\uff0c\u5728SwiftUI\u4e2d\uff0cUIHostingController\u6240\u6709view [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1129"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1129"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1129\/revisions"}],"predecessor-version":[{"id":1134,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/1129\/revisions\/1134"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}