swift中UIActionSheet的使用

2021-07-23 05:33:38 字數 1842 閱讀 2910

// 方法1

// 方法2

// 例項化時新增**物件,同時注意新增協議

let alertsheet = uiactionsheet(title: alerttitle, delegate: self, cancelbuttontitle: alertok, destructivebuttontitle: alertcancel, otherbuttontitles: "警告", "提示", "通告")

alertsheet.showinview(self.view)

// 新增協議

class viewcontroller: uiviewcontroller, uiactionsheetdelegate

...}

// **方法

// 方法3

// 1 例項化

let alertsheet = uialertcontroller(title: alerttitle, message: alertmessage, preferredstyle: uialertcontrollerstyle.actionsheet)

// 2 命令(樣式:退出cancel,警告destructive-按鈕標題為紅色,預設default)

let cancelaction = uialertaction(title: alertcancel, style: uialertactionstyle.cancel, handler: nil)

let deleteaction = uialertaction(title: "刪除", style: uialertactionstyle.destructive, handler: nil)

let archiveaction = uialertaction(title: alertok, style: uialertactionstyle.default, handler: )

alertsheet.addaction(cancelaction)

alertsheet.addaction(deleteaction)

alertsheet.addaction(archiveaction)

// 3 跳轉

swift中UIProgressView的使用

預設高度是 2.0。自定義高度無效,可通過 transform 屬性設定高度 例項化 預設高度是2.0。自定義高度無效,可通過transform屬性設定高度 let progressview uiprogressview frame cgrectmake 10.0,10.0,cgrectgetwid...

swift中UIProgressView的使用

預設高度是2.0。自定義高度無效,可通過transform屬性設定高度 html view plain copy 例項化 預設高度是2.0。自定義高度無效,可通過transform屬性設定高度 let progressview uiprogressview frame cgrectmake 10.0...

swift中collectionView的簡單用法

之前寫過oc中collectionview的用法,現在再看看swift中collectionview的用法,有興趣的朋友,可以兩者前後比較下區別,swift現在沒有穩定下來,語法更新的比較快,但是它核心的一些東西,已經定型了。這些還是靠讀者們自己去挖掘吧。這裡簽署資料來源和 此時不需要引入layou...