当我在swift UI中对Rectangle做转角半径时,我得到了下面的输出。

var body: some View {
ZStack {
Rectangle()
.overlay(Rectangle()
.stroke(Color.red, lineWidth: 50))
.foregroundColor(Color.white)
}
}顶部和底部是正确的,但前导和尾随lineWidth是给定值的一半。
如何解决这个问题?
发布于 2020-07-06 19:29:39
笔划以线条为中心。据我所知,你的期望可以这样解决
使用Xcode11.4/ iOS 13.4进行测试

ZStack {
Rectangle()
.overlay(Rectangle()
.fill(Color.white).padding(50))
.foregroundColor(Color.red)
}.edgesIgnoringSafeArea(.all) // comment if you don't need full screenhttps://stackoverflow.com/questions/62754846
复制相似问题