前面學習swift以及swiftui,忘了記錄,現在補上,配置:win10 掛載macos10.15.3系統的虛擬機器,編譯工具:xcode11.4(ps:虛擬機器是真的卡,每執行一次3min。。。)
頁面屬性
ui教程
github專案
swift**練習
時序曲線
command+i 設定縮排
選中的** + command+[ :向左位移
選中的** + command+]: 向右位移
選中的** + command+option+[ :向上位移
選中的** + command+option+]:向下位移
/*針對於text的語法*/
.font
(.title)
//設定字型型別
.fontweight
(.semibold)
//設定字型粗細
.foregroundcolor
(color
.red)
//設定字型前景顏色
.mutilinetextalignment
(.leading/
.center)
//設定多行對齊
.linespacing(4
)//設定行距
text
("\bottom(state.height)").
offset
(y:-
300)
//即時獲取位置資訊
image
(systemname:
"gear"
)//系統圖示及字型可直接呼叫
.font(.
system
(size:
20,weight:
.bold, design:
.rounded)
)//設定字型
.overlay //疊加層
/*針對於image/vstack/hstack/zstack的語法*/
spacer()
//在幾個模組間加入空間
.frame
(width:
340.0
, height:
220.0,alignment:
.top )
//設定外框,保證內容在外框裡面
.resizable()
//保證影象適應外框,但會使高寬比失調
.aspectratio
(contentmode:
.fill/
.fit)
//在適應外框的基礎上,影象不變形
.background
(color
.blue)
//設定背景色
.cornerradius(20
)//設定圓角及其半徑
.shadow
(radius:20)
//新增陰影及其半徑(必須先新增圓角,再新增陰影)
.shadow
(color:
color
.black.
opacity
(0.2
),radius:
20,x:
0,y:20)
//自定義陰影
.padding()
//設定模組距離邊框內邊距的長度(可以單獨新增給水平或垂直
eg..
padding
(.horizontal,20)
/.padding
(.top,20)
.offset
(x:0
,y:-20)
//設定模組偏移量
.scaleeffect
(0.7
)//設定模組縮放
.rotationeffect
(angle
.degree(5
))//設定旋轉角度
.rotation3deffect
(angle
.degree(5
),axis:
(x:10.0
,y:0
,z:0
)//設定3d旋轉角度
.blendermode
(.hardlight)
//設定混合模式
rectangle()
//矩形檢視
.opacity
(0.1
)//設定透明度
.frame
(maxwidth:
.infinity)
//將框架設定為最大寬度
.blur
( radius:20)
//設定模糊程度
.clipshape
(roundrrctangle
(cornerradius:
20,style:continuous)
)//設定平滑角
.clipshape
(circle()
)//裁剪成圓角
.background
(lineargradient
(gradient:
gradient
(colors[
color
.red,
color
.blue]
),startpoint:
.leading,endpoint:
.trailing)
)//設定漸變色
color
literal
//自由選擇顏色
@state
var show =
false
//設定狀態(動畫間切換)
.ontapgesture
.rotationeffect(angle
.degrees
(show ?0:
5)//三元運算子判斷
.offset
(x:0
, y:show?
-200:-
20)//三元運算子判斷
.animation
(.linenear)
//線性動畫
.animation
(.easeinout)
//平滑開始,平滑結束
.animation
(.easeinout,duration(:
0.3)
)//平滑開始,平滑結束
.animation(.
default
)
@state
var showcard =
false
.animation(.
timingcurve
(0.2
,0.8
,0.2,1
,duration:
0.8)
)//時序曲線
.animation
(//細節修飾
animation
.default
.delay
(0.1).
speed(2
)//二倍速
)
@state
var viewstate =
cgsize
.zero
.offset
(x: viewstate.width, y:viewstate.height)
//使得即時返回`
.gesture
(// 拖拽手勢`
draggesture()
.onchange
.onended
).animation (
.spring()
)//彈性舒緩
/*response: 0.3 設定響應速度,數值越小,響應越快
dampingfraction: 0.3 數字越小,彈性係數越大
blendduration: 0 設定引數設定滯後時間
*/
color
(.grey)
.edgesignoringsafearea
(.all)
//設定頁面安全區域
@state
var showprofile =
false
button
(action:
)
SQL 常用基礎語句
1 sql select 語句 語法 select 列名稱 from 表名稱 2 sql select distinct 語句 語法 select distinct 列名稱 from 表名稱 3 sql where 語句 語法 select 列名稱 from 表名稱 where 列 運算子 值 操作...
SwiftUI機器學習基礎之三類常用的模型格式
訓練完機器學習模型後,您可能需要在應用程式中使用該模型。要使用模型,您首先需要將模型匯出為計算機硬碟上的適當檔案格式。不幸的是,大量模型構建庫和缺乏標準化的結合導致用於機器學習模型的自定義檔案格式的數量激增。大多數模型構建庫都有其自己的自定義檔案格式,有時這些格式不可互操作。存在多種將模型從一種專有...
SQL語句 常用(基礎篇)
sql structured query language 結構化查詢語言,是用於訪問和處理資料庫的標準的計算機語言。sql 是一種 ansi american national standards institute 美國國家標準化組織 標準的計算機語言。select語句 select from ...