重置按钮增加确认弹窗

This commit is contained in:
2026-07-15 22:31:16 +08:00
parent 6c62d4bce4
commit adf13ae47c
2 changed files with 26 additions and 0 deletions
+13
View File
@@ -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)
+13
View File
@@ -192,6 +192,19 @@ class FormatNoteViewController: 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 = ""
rightBarButtonMode = .paste
isCloudFormatted = false