我正在try 创建一个带有省略号SFSymbol的圆形按钮,这样椭圆就是白色的,背景是圆形的.我try 了两种方法,一种是填充椭圆图像,另一种是规则椭圆图像.
我希望实现的输出是:
与我目前所拥有的相比:
对于第一个按钮,它是全白的(似乎不能像我想象的那样应用色调加前景样式),而使用第二种方法,它不再是圆形的(除非我可能应用了一个剪裁形状?但这似乎太复杂了).有没有办法达到Button
%的yields
struct ContentView: View {
var body: some View {
VStack(spacing: 50) {
Button(action: {}, label: {
Image(systemName: "ellipsis.circle.fill")
.resizable()
.scaledToFit()
.frame(width: 40)
})
.tint(.secondary)
.foregroundStyle(.white)
Button(action: {}, label: {
Image(systemName: "ellipsis")
.resizable()
.scaledToFit()
.frame(width: 40, height: 40)
})
.buttonStyle(.borderedProminent)
.buttonBorderShape(.capsule)
.tint(.secondary)
.foregroundStyle(.white)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background {
Color.black
.ignoresSafeArea(edges: .all)
}
}
}