SwiftUI 基础之圆形文字按钮ZStack Button Circle(2020)

2,077 阅读1分钟

本文介绍了圆形文字按钮的制作过程 使用的技术

  • ZStack
  • Button
  • Circle()
  • Text

代码

import SwiftUI

struct ContentView: View {
    var body: some View {
          Button(action: {
              }){
                  ZStack{
                      Circle()
                      .frame(width: 100, height: 100)
                      .foregroundColor(.blue)
                    Text("Press me")
                        .foregroundColor(.white)
                  }
              }
    }
}

效果

Jietu20200129-172355@2x.jpg

更多SwiftUI教程和代码关注专栏