【发布时间】:2022-01-06 16:28:38
【问题描述】:
我在 SwiftUI 中使用下面的代码为所有边添加了边框。我想修剪描边一个特定的位置,如下所示。
想要达到:-
输出:-
代码:-
import SwiftUI
struct RoundTrimImage: View {
var body: some View {
VStack{
Button(action: {
print("Round Action")
}) {
Text("Press")
.frame(width: 100, height: 100)
.foregroundColor(Color.black)
.background(Color.red)
.clipShape(Circle()).padding(5)
.overlay(
RoundedRectangle(cornerRadius: 100)
.trim(from: 0, to: CGFloat(0.8))
.stroke(Color.blue, lineWidth: 2)
)
}
}
}
}
问题:谁能给我解释一下如何修剪特定位置,我已经尝试过上面的代码,但还没有结果。
有人可以向我解释如何获得进度吗?
任何帮助将不胜感激。
提前致谢。
【问题讨论】:
标签: button swiftui uibutton stroke cornerradius