macOS SwiftUI教程之从饼图中显示百分比(教程含源码)
作者:互联网
实战需求
macOS SwiftUI教程之从饼图中显示百分比
本文价值与收获
看完本文后,您将能够作出下面的界面
看完本文您将掌握的技能
- addArc
- move
- addLine
- .offset(x: 20, y: 20)
- .overlay( Text(“25%”)
基础知识
addArc
向路径添加圆弧,并指定半径和角度。
mutating func addArc(center: CGPoint, radius: CGFloat, startAngle: Angle, endAngle: Angle, clockwise: Bool, transform: CGAffineTransform = .identity)
实战代码
import SwiftUI
struct ContentView: View {
var body: some View {
VStack{
ZStack {
Path { path in
path.move(to: CGPoint(x: 187, y: 187))
path.addArc
标签:教程,CGPoint,addArc,move,macOS,源码,SwiftUI,path 来源: https://blog.csdn.net/iCloudEnd/article/details/111085320