SwifUI Zstack无法在多个设备中工作

问题描述

我有代码

struct ContentView: View {
    var body: some View {
        ZStack {
            Image("bird")
                .resizable()
                .aspectRatio(contentMode: .fill)
                .edgesIgnoringSafeArea(.all)
            Image(systemName: "camera.on.rectangle")
                .offset(x: 160,y: -380)
                .font(.largeTitle)
            Image(systemName: "heart")
                .offset(x: -160,y: 380)
                .font(.largeTitle)
                .foregroundColor(.red)
            Image(systemName: "square.and.arrow.up.on.square")
                .offset(x: -160,y: -380)
                .font(.largeTitle)
        }
    }
}

我使用.offset来设置图像的特定位置。但是,当我更改为另一种设备格式时,它们就会消失。有没有办法限制或更好地使此代码在SwiftUI中正常运行?

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)