【Swift】类似于微博、微信的ActionSheet
生活随笔
收集整理的這篇文章主要介紹了
【Swift】类似于微博、微信的ActionSheet
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1、 PGActionSheet使用了UITableView進行復用 2、為了更好的融合當前的界面,PGActionSheet默認的彈出框的透明度是0.7
GitHub 地址:
https://github.com/xiaozhuxiong121/PGActionSheet
CocoaPods安裝
pod 'PGActionSheet' 復制代碼使用
let actionSheet = PGActionSheet(cancelButton: true, buttonList: ["收藏", "保存", "編輯"]) present(actionSheet, animated: false, completion: nil) 復制代碼有兩種方式監(jiān)聽點擊事件 1、閉包
actionSheet.handler = {index inprint("index = ", index) } 復制代碼2、代理
func actionSheet(_ actionSheet: PGActionSheet, clickedButtonAt index: Int) {print("index = ", index) } 復制代碼設置title
actionSheet.actionSheetTitle = "PGActionSheet" 復制代碼取消彈出框的透明度
actionSheet.actionSheetTranslucent = false 復制代碼取消背景的半透明
actionSheet.translucent = false 復制代碼自定義顯示字的樣式
actionSheet.textFont = UIFont.boldSystemFont(ofSize: 20) actionSheet.textColor = UIColor.orange 復制代碼自定義取消按鈕的樣式
actionSheet.cancelTextColor = UIColor.blue actionSheet.cancelTextFont = UIFont.systemFont(ofSize: 20) 復制代碼自定義title的樣式
actionSheet.actionSheetTitleFont = UIFont.boldSystemFont(ofSize: 22) actionSheet.actionSheetTitleColor = UIColor.red 復制代碼轉(zhuǎn)載于:https://juejin.im/post/5a312cdf6fb9a04514640afd
總結(jié)
以上是生活随笔為你收集整理的【Swift】类似于微博、微信的ActionSheet的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Go -- php 中的pack(H*,
- 下一篇: cobbler get-loaders