您需要一个带有主图像的 ZStack 和一个带有图标的按钮。您可以定义图像的对齐方式 - 在本例中.topTrailing:
struct LayeredImage: View {
var body: some View {
ZStack(alignment: .topTrailing) {
Image("card")
.resizable()
.aspectRatio(contentMode: .fit)
.padding(6.0)
Button(action: { }) {
Image(systemName: "ellipsis.circle.fill")
.foregroundColor(.gray)
.font(.largeTitle)
}
} .padding()
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
294 次 |
| 最近记录: |