本文介绍了圆形文字按钮的制作过程
使用的技术
  • 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教程和代码关注专栏


iCloudEnd
36 声望10 粉丝

iOS & Mac OS 攻城师 (历史 & 金融 & 美食 爱好者)