我想创建一个带有边框和背景颜色的圆角矩形视图的按钮。
到目前为止我写了这个:
Button(action: {
}, label: {
Text("TAP ME")
.foregroundColor(Color.blue)
})
.frame(height: 50)
.frame(maxWidth: .infinity)
.overlay(
RoundedRectangle(cornerRadius: 50, style: .continuous)
.strokeBorder(Color.blue, lineWidth: 1)
)
Run Code Online (Sandbox Code Playgroud)
我试图.background(Color.red)
在许多不同的地方添加,但这是我每次得到的:
在这里做什么?
感谢您的帮助
Asp*_*eri 10
据我了解您的需求,这是一个解决方案
Button(action: {
}, label: {
Text("TAP ME")
.foregroundColor(Color.blue)
})
.frame(height: 50)
.frame(maxWidth: .infinity)
.background(
RoundedRectangle(cornerRadius: 50, style: .continuous).fill(Color.red)
)
.overlay(
RoundedRectangle(cornerRadius: 50, style: .continuous)
.strokeBorder(Color.blue, lineWidth: 1)
)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1070 次 |
最近记录: |