我有一个快速RoundedRectangle:
ScrollView(.horizontal, showsIndicators: false) {
Group {
HStack {
if let height = height {
if height != "" {
aboutMeItem(info: height, image: "ruler").frame(minWidth: 20)
}
}
}
.frame(minHeight: 70, maxHeight: 70)
.overlay(RoundedRectangle(cornerRadius: 15).stroke(Color("darkGrey"), lineWidth: 3))
.padding([.leading,.top,.trailing])
}
}
Run Code Online (Sandbox Code Playgroud)
我的输出是:
由于某种原因,底线被稍微切掉,您看不到完整的线宽。
Iv 尝试删除其下方的视图,以防有东西覆盖它,但事实并非如此。我尝试过弄乱 和frame min,maxHeight但无论如何,那仍然是一样的。
您应该使用strokeBorder而不是stroke.
你做的另一件事是.padding([.leading,.top,.trailing])你没有包括底部!但我认为strokeBorder也会涵盖这一点。
ScrollView(.horizontal, showsIndicators: false) {
Group {
HStack {
if let height = height {
if height != "" {
aboutMeItem(info: height, image: "ruler").frame(minWidth: 20)
}
}
}
.frame(minHeight: 70, maxHeight: 70)
.overlay(RoundedRectangle(cornerRadius: 15).strokeBorder(Color("darkGrey"), lineWidth: 3)) // <<: Here
.padding([.leading,.top,.trailing]) // <<: Here!!! you did not used .bottom
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
703 次 |
| 最近记录: |