ZDialog
用于轻松显示类似于警告对话框的对话框的ZDialog库
ZAlertDialog简单易用,可以通过支持标题和消息的多行
显示,并且如果设置了长消息,内容是可滚动的
。
以下是一些使用示例:
import UIKit
import ZDialog
class ViewController: UIViewController {
lazy var alertDialog = ZAlertDialog()
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func showNormalDialog(_ sender: UIButton) {
alertDialog
.setTitle("normal dialog")
.setMessage("Are you love Swift?")
.setOkButton("YES")
.setCancelButton("NO")
.setOkButton(onTapListener: {
print("ok button taped")
})
.showDialog(self)
}
}
可用方法
//Set the title of the dialog
setTitle(_ title)
//Set the title of the dialog
setMessage(_ message)
//hidden or show buttons(ok, cancel)
setHiddenButtons()
//set title and tap listener for Ok button
setOkButton(_ title, onTapListener)
//set title and tap listener for Cancel button
setCancelButton(_ title, onTapListener)
//support rtl or ltr
setRTL(_ isRTL)
//Set position of the dialog (style => .center, .bottom)
setPositionStyle(_ style)
//When dismisses the dialog this method called
setOnDismissListener()
//allow or not allow to user for dismiss the dialog when tap around of dialog
setCancelable(_ isCancelable)
安装
ZDialog可通过CocoaPods获取。要安装,只需将以下行添加到您的Podfile中:
pod 'ZDialog'
作者
zabih, [email protected]
许可
ZDialog在MIT许可下提供。有关更多信息,请参阅LICENSE文件。