ios - 如何使用 SwiftUI 让我的 UI 很好地适应 iPad 屏幕?
问题描述
struct PasswordGenerator : View {
var body: some View {
NavigationView {
VStack {
Spacer()
Text("Upon clicking the button the password\nwill also be copied so you\ncan simply paste")
.lineLimit(nil)
Spacer()
Button(action: generatePassword) {
HStack {
Image("GeneratorGlyph")
Text("Generate!").font(.title)
}
.accentColor(.white)
.frame(minHeight: 56, maxHeight: 112)
.padding(.horizontal, 80)
}
.background(LinearGradient(gradient: Gradient(colors: [Color.init(red: 48/255, green: 153/255, blue: 216/255), Color.init(red: 65/255, green: 165/255, blue: 237/255)]), startPoint: .topLeading, endPoint: .bottomTrailing), cornerRadius: 9)
Spacer()
}
.navigationBarTitle(Text("Generator"), displayMode: .inline)
}
}
}
这就是代码在 iPad Pro 屏幕上的样子,我不知道如何让它正确扩展。有人知道我该怎么做吗?
解决方案
推荐阅读
- react-native - 如何使用不同的包标识符设置不同的 env 文件?
- .net - 在 Clean Architecture 设计中,我们是否需要为每一层创建一个单独的“项目”?
- css - 动画期间未应用 CSS 变量更改
- latex - LaTeX 错误:环境 pandoccrossrefsubfigures 未定义
- apache-spark - 火花 3.1.1 | 无法运行作业:应使用 IDENTIFIER 而不是“[”
- flutter - 从 Excel 获取数据到 Listview
- angular-material - 如何更改垫子选择中下拉菜单的方向?
- sql - SQL Server:基于存储过程和动态 sql 的物化视图 - 如何
- jmeter - 如何从 JRS223 脚本中找到并重命名 jtl 文件?
- angular - 访问 Angular 中的块状工具箱类别