【发布时间】:2021-08-27 18:23:29
【问题描述】:
我目前正在尝试将人物图像底部拖尾与 SwiftUI 视图中图像的底部边缘对齐。
代码:-
struct AddSecondImageOnSameImage: View {
@State var image = Image(systemName: "person.circle.fill")
var body: some View {
VStack{
self.image
.renderingMode(.original)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 100, height: 100)
.clipShape(Circle())
.padding(1)
.overlay(Circle()
.frame(width: 20, height:20)
.foregroundColor(Color.init(UIColor.init(displayP3Red: 255/255, green: 92/255, blue: 210/255, alpha: 1.0))),alignment: .bottomTrailing)
}
}
}
输出:-
]
想要实现:-
有人可以向我解释一下如何在 SwiftUI 视图中将人物图像的底部尾随与图像的底部边缘对齐。我已经尝试按照上面的方法实现,但还没有结果。 任何帮助将不胜感激。 提前致谢。
【问题讨论】:
-
设置偏移修改器(-10,-10),将推回一半大小