platform :ios,'13.0'
use_frameworks!
target 'DemoApp'do
source 'https://github.com/CocoaPods/Specs.git'
pod 'SCLAlertView'
end
1. 弹窗——各种提示窗
importUIKitimportSCLAlertView//classViewController:UIViewController{overridefuncviewDidLoad(){super.viewDidLoad()// Test UI:let popup =UIButton(frame:CGRect(x:0, y:0, width:320, height:40))
popup.center =self.view.center
popup.backgroundColor =UIColor.orange
popup.setTitle("Popup",for:.normal)
popup.titleLabel?.font =.systemFont(ofSize:24)
popup.addTarget(self, action: #selector(yeBtn),for:.touchUpInside)self.view.backgroundColor =UIColor.orange
self.view.addSubview(popup)}@objcfuncyeBtn(){//yeTye1()//yeTye2()//yeTye3()yeTye4()}funcyeTye1(){// 1.SCLAlertView().showInfo("Important info", subTitle:"You are great")}// 重新设置标题和子标题:funcyeTye2(){// 2. 初始化,设置标题和子标题: (类型: 成功图标)let alertViewResponder:SCLAlertViewResponder=SCLAlertView().showSuccess("Hello World", subTitle:"This is a more descriptive text.")// 重新设置标题和子标题:
alertViewResponder.setTitle("New Title")
alertViewResponder.setSubTitle("New description")}// 各种类型:funcyeTye3(){// 3.SCLAlertView().showError("Hello Error", subTitle:"This is a more descriptive error text.")// 4.SCLAlertView().showNotice("Hello Notice", subTitle:"This is a more descriptive notice text.")// 5.SCLAlertView().showWarning("Hello Warning", subTitle:"This is a more descriptive warning text.")// 6.SCLAlertView().showInfo("Hello Info", subTitle:"This is a more descriptive info text.")// 7.SCLAlertView().showEdit("Hello Edit", subTitle:"This is a more descriptive info text.")}}