重置按钮增加确认弹窗
This commit is contained in:
@@ -184,6 +184,19 @@ class FormatLogViewController: UIViewController {
|
||||
}
|
||||
|
||||
@objc private func didTapResetButton() {
|
||||
let alert = UIAlertController(
|
||||
title: "确认重置",
|
||||
message: "确定要清空当前内容吗?",
|
||||
preferredStyle: .alert
|
||||
)
|
||||
alert.addAction(UIAlertAction(title: "取消", style: .cancel))
|
||||
alert.addAction(UIAlertAction(title: "重置", style: .destructive) { [weak self] _ in
|
||||
self?.performReset()
|
||||
})
|
||||
present(alert, animated: true)
|
||||
}
|
||||
|
||||
private func performReset() {
|
||||
textView.text = ""
|
||||
isFormatted = false
|
||||
formatButton.setTitle("格式化", for: .normal)
|
||||
|
||||
Reference in New Issue
Block a user