From 230a9ad26013d1cf7ef0985106e623a371deb8b4 Mon Sep 17 00:00:00 2001 From: fish Date: Sun, 12 Jul 2026 20:59:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Note/FormatLogViewController.swift | 38 +++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Note/FormatLogViewController.swift b/Note/FormatLogViewController.swift index 4075d9e..b96a240 100644 --- a/Note/FormatLogViewController.swift +++ b/Note/FormatLogViewController.swift @@ -9,9 +9,45 @@ import UIKit class FormatLogViewController: UIViewController { + private var textView: UITextView! + private var formatButton: UIButton! + override func viewDidLoad() { super.viewDidLoad() title = "格式化日志" - view.backgroundColor = .systemBackground + navigationItem.largeTitleDisplayMode = .never + view.backgroundColor = .systemGroupedBackground + setupUI() + } + + private func setupUI() { + textView = UITextView() + textView.translatesAutoresizingMaskIntoConstraints = false + textView.font = UIFont.systemFont(ofSize: 16) + textView.backgroundColor = .white + textView.layer.cornerRadius = 12 + textView.textContainerInset = UIEdgeInsets(top: 12, left: 12, bottom: 12, right: 12) + view.addSubview(textView) + + formatButton = UIButton(type: .system) + formatButton.translatesAutoresizingMaskIntoConstraints = false + formatButton.setTitle("格式化", for: .normal) + formatButton.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold) + formatButton.backgroundColor = .systemBlue + formatButton.setTitleColor(.white, for: .normal) + formatButton.layer.cornerRadius = 12 + view.addSubview(formatButton) + + NSLayoutConstraint.activate([ + textView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 16), + textView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), + textView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16), + textView.bottomAnchor.constraint(equalTo: formatButton.topAnchor, constant: -16), + + formatButton.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), + formatButton.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16), + formatButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -16), + formatButton.heightAnchor.constraint(equalToConstant: 52) + ]) } }