实战需求
macOS SwiftUI教程之绘制环形图RingView
本文价值与收获
看完本文后,您将能够作出下面的界面

看完本文您将掌握的技能
- .fill(Color(.darkGray))填充整个圆的背景
- .stroke(Color(.red), style: StrokeStyle(lineWidth: 12, lineCap: .round, lineJoin: .round)) 通过边框实行百分比效果
- 设置高度.frame(width: 10, height: CGFloat(value))
- .rotationEffect(.degrees(180)) 旋转
- .rotation3DEffect(.degrees(180), axis: (x: 1, y: 0, z: 0))3D旋转
实战代码
1、主界面
<code>import SwiftUI
struct ContentView: View {
var body: some View {
VStack{
RingView()
}.frame(minWidth:600,minHeight: 400)
}
}
</code>
2、header
<code>import SwiftUI
struct HeaderView: View {
let title: String</code>
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!