试着这样做:不要为按钮设置拐角半径,而是为内部视图使用覆盖:
编辑:如果你有一个按钮的背景,你还需要将cornerRadius应用于背景.
Button(action: {
print("sign up bin tapped")
}) {
Text("SIGN UP")
.frame(minWidth: 0, maxWidth: .infinity)
.font(.system(size: 18))
.padding()
.foregroundColor(.white)
.overlay(
RoundedRectangle(cornerRadius: 25)
.stroke(Color.white, lineWidth: 2)
)
}
.background(Color.yellow) // If you have this
.cornerRadius(25) // You also need the cornerRadius here
对我有用.如果有帮助,请告诉我!