文字視圖(Text)
簡單初始化一個文字視圖
Text("Hello World")
修改文字屬性
Text("Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry.")
.fontWeight(.bold) //設(shè)置字重
.font(.title) //設(shè)置字體
.foregroundColor(.green)//字體顏色
.multilineTextAlignment(.center) //對齊方式
// .lineLimit(3) //最大行數(shù)
// .truncationMode(.head) //截斷方式
.lineSpacing(10) //文字行間距
// .padding() //組件邊距
修改字體設(shè)計
// 讓字體圓潤
.font(.system(.largeTitle, design: .rounded))
2d旋轉(zhuǎn)
.rotationEffect(.degrees(20), anchor: UnitPoint(x: 0, y: 0))
16791179512395.jpg
3d旋轉(zhuǎn)
.rotation3DEffect(.degrees(60), axis: (x: 1, y: 0, z: 0))
16791179512424.jpg
陰影
.shadow(color: .gray, radius: 2, x: 0, y: 15)
16791179512472.jpg
markdown 支持
SwiftUI text 視圖已支持markdown