{"id":3171,"date":"2021-06-09T20:58:24","date_gmt":"2021-06-09T12:58:24","guid":{"rendered":"http:\/\/123.57.164.21\/?p=3171"},"modified":"2021-06-09T20:58:24","modified_gmt":"2021-06-09T12:58:24","slug":"swiftui-%e5%a6%82%e4%bd%95resize%e4%b8%80%e4%b8%aapickerview","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=3171","title":{"rendered":"SwiftUI  \u5982\u4f55resize\u4e00\u4e2aPickerView?"},"content":{"rendered":"\n<p>\u5982\u4e0b\u9762\u4ee3\u7801\u6240\u793a\uff0c\u5e0c\u671b\u7528Picker\u753b\u4e00\u4e2a\u65f6\u95f4\u9009\u62e9\u5668\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=\"\">struct DatePickerView: View {\n    @State var dateHour: Int = 0\n    @State var dateMinute: Int = 0\n    var body: some View {\n        VStack {\n\n            HStack {\n\n                HStack {\n                    Picker(\"Hour\", selection: $dateHour) {\n                        ForEach(0..&lt;24) { i in\n                            Text(CommonUtil.appendZero(num: i)).frame(width: 30)\n                        }\n                    }.frame(width: 50).pickerStyle(WheelPickerStyle())\n                }\n\n                Text(\":\")\n\n                HStack {\n                    Picker(\"Minute\", selection: $dateMinute) {\n                        ForEach(0..&lt;60) { i in\n                            Text(CommonUtil.appendZero(num: i)).frame(width: 30)\n                        }\n                    }.frame(width: 50).pickerStyle(WheelPickerStyle())\n                }\n            }\n            Spacer().frame(height: 20)\n        }.frame(width: 228, height: 346)<\/pre>\n\n\n\n<p>\u4f46\u662f\u6548\u679c\u5374\u4e0d\u5c3d\u5982\u4eba\u610f\uff5e<\/p>\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\/2021\/06\/image-41.png\" alt=\"\" class=\"wp-image-3172\" width=\"419\" height=\"399\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-41.png 790w, https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-41-300x286.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-41-768x731.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-41-230x219.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-41-350x333.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-41-480x457.png 480w\" sizes=\"(max-width: 419px) 100vw, 419px\" \/><\/figure><\/div>\n\n\n\n<p>\u90a3\u4e48\u5982\u4f55resize\u4e00\u4e2aPickerView\u5462\uff0c\u9700\u8981\u7528\u5230.clipped()<\/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=\"\">struct DatePickerView: View {\n    @State var dateHour: Int = 0\n    @State var dateMinute: Int = 0\n    var body: some View {\n        VStack {\n\n            HStack {\n\n                HStack {\n                    Picker(\"Hour\", selection: $dateHour) {\n                        ForEach(0..&lt;24) { i in\n                            Text(CommonUtil.appendZero(num: i)).frame(width: 30)\n                        }\n                    }.frame(width: 50).pickerStyle(WheelPickerStyle()).clipped()\n                }\n\n                Text(\":\")\n\n                HStack {\n                    Picker(\"Minute\", selection: $dateMinute) {\n                        ForEach(0..&lt;60) { i in\n                            Text(CommonUtil.appendZero(num: i)).frame(width: 30)\n                        }\n                    }.frame(width: 50).pickerStyle(WheelPickerStyle()).clipped()\n                }\n            }\n            Spacer().frame(height: 20)\n        }.frame(width: 228, height: 346)<\/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\/2021\/06\/image-42.png\" alt=\"\" class=\"wp-image-3174\" width=\"310\" height=\"327\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-42.png 504w, https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-42-284x300.png 284w, https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-42-230x243.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-42-350x369.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/06\/image-42-480x507.png 480w\" sizes=\"(max-width: 310px) 100vw, 310px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4e0b\u9762\u4ee3\u7801\u6240\u793a\uff0c\u5e0c\u671b\u7528Picker\u753b\u4e00\u4e2a\u65f6\u95f4\u9009\u62e9\u5668\u3002 \u4f46\u662f\u6548\u679c\u5374\u4e0d\u5c3d\u5982\u4eba\u610f\uff5e \u90a3\u4e48\u5982\u4f55resize\u4e00\u4e2aPick [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/3171"}],"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=3171"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/3171\/revisions"}],"predecessor-version":[{"id":3175,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/3171\/revisions\/3175"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}