How to make iOS App fullscreen using SwiftUI views?
How to make iOS App fullscreen using SwiftUI views?
如何使用 SwiftUI 视图让 iOS App 全屏显示?
iPad 全屏时钟
自开发 App,无广告,纯净版 🚀
...todo
SwiftUI x fullscreen API
fullScreenCover
nonisolated
func fullScreenCover<Content>(
isPresented: Binding<Bool>,
onDismiss: (() -> Void)? = nil,
@ViewBuilder content: @escaping () -> Content
) -> some View where Content : View
nonisolated
func fullScreenCover<Item, Content>(
item: Binding<Item?>,
onDismiss: (() -> Void)? = nil,
@ViewBuilder content: @escaping (Item) -> Content
) -> some View where Item : Identifiable, Content : View
https://developer.apple.com/documentation/swiftui/view/fullscreencover(item:ondismiss:content:)
import SwiftUI
struct FullScreenModalView: View {
@Environment(\.presentationMode) var presentationMode
var body: some View {
VStack {
Text("Hello, World!")
.padding()
Button("Dismiss") {
presentationMode.wrappedValue.dismiss()
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.red)
.edgesIgnoringSafeArea(.all)
.onTapGesture {
presentationMode.wrappedValue.dismiss()
}
}
}
struct ContentView: View {
@State private var isPresented = false
var body: some View {
Button("Show Full Screen Modal") {
self.isPresented.toggle()
// isPresented.toggle()
}
.fullScreenCover(isPresented: $isPresented, content: FullScreenModalView.init)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
https://www.youtube.com/results?search_query=SwiftUI+Fullscreen
demos
fliqlo / 飞客
收费: $ 0.99
/ ¥ 8.0
https://apps.apple.com/cn/app/fliqlo/id900833042?l=en-GB
https://search.bilibili.com/all?vt=61108718&keyword=ipad+桌面时钟
Web 网页版 WKWebView
Fullscreen API
webView.configuration.preferences.isElementFullscreenEnabled = true
webView.loadHTMLString("""
<script>
button.addEventListener('click', () => {
canvas.webkitRequestFullscreen()
}, false);
</script>
…
""", baseURL:nil)
// 👇🏻 use this if you want to customize the full screen transactions in your app
let observation = webView.observe(\.fullscreenState, options: [.new]) { object, change in
print("fullscreenState: \(object.fullscreenState)")
}
https://wwdcnotes.com/documentation/wwdcnotes/wwdc22-10049-whats-new-in-wkwebview/
refs
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/18634706
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2023-12-27 macOS Sonoma All In One
2022-12-27 Linux bash shell "${1}" All In One
2021-12-27 Linux Command Line Cheat Sheet All In One
2021-12-27 js array auto expand All In One
2020-12-27 上海市居住证积分办理流程 2020~2021 最新
2020-12-27 前端水印方案 All In One
2020-12-27 postman skills