重置按钮增加确认弹窗
This commit is contained in:
@@ -184,6 +184,19 @@ class FormatLogViewController: UIViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc private func didTapResetButton() {
|
@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 = ""
|
textView.text = ""
|
||||||
isFormatted = false
|
isFormatted = false
|
||||||
formatButton.setTitle("格式化", for: .normal)
|
formatButton.setTitle("格式化", for: .normal)
|
||||||
|
|||||||
@@ -192,6 +192,19 @@ class FormatNoteViewController: UIViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc private func didTapResetButton() {
|
@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 = ""
|
textView.text = ""
|
||||||
rightBarButtonMode = .paste
|
rightBarButtonMode = .paste
|
||||||
isCloudFormatted = false
|
isCloudFormatted = false
|
||||||
|
|||||||
Reference in New Issue
Block a user