【发布时间】:2019-11-27 18:15:24
【问题描述】:
我用以下代码创建了一个圆形按钮:
struct RoundButton : View {
var value = "..."
var body: some View {
GeometryReader { geometry in
Button(action: {}) {
VStack {
Text(self.value)
.font(.headline)
.color(Color("NightlyDark"))
Text("MIN")
.font(.footnote)
.color(.white)
}
.frame(width: geometry.size.width, height: geometry.size.height)
}
.clipShape(Circle())
}
}
}
但是当点击按钮时,形状会变形。知道为什么会这样吗?
当我使用.mask(Circle()) 时也会发生同样的情况
这是测试版还是正常行为?有没有人知道创建圆形按钮的更好方法?
【问题讨论】:
标签: xcode button rounding swiftui beta