Contents 非表示
実装
Storyboard
コード
import UIKit
import PKHUD
class ViewController: UIViewController {
@IBOutlet private weak var successButton: UIButton!
@IBOutlet private weak var errorButton: UIButton!
@IBOutlet private weak var loadingButton: UIButton!
@IBOutlet private weak var textButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
setupView()
}
private func setupView() {
successButton.layer.cornerRadius = 20.0
errorButton.layer.cornerRadius = 20.0
loadingButton.layer.cornerRadius = 20.0
textButton.layer.cornerRadius = 20.0
}
@IBAction func successAction(_ sender: Any) {
HUD.flash(.success, delay: 1.0)
}
@IBAction func errorAction(_ sender: Any) {
HUD.flash(.error, delay: 1.0)
}
@IBAction func loadingAction(_ sender: Any) {
HUD.flash(.progress, delay: 1.0)
}
@IBAction func textAction(_ sender: Any) {
HUD.flash(.label("テキストメッセージを表示するよ"), delay: 1.0)
}
}