Compare commits

..

6 Commits

Author SHA1 Message Date
fish 230a9ad260 格式化日志页面细节调整 2026-07-12 20:59:54 +08:00
fish ce9d1cff19 首页标题改为大标题样式 2026-07-12 20:54:07 +08:00
fish 7d42eec98c 首页三个入口合并为一个面板 2026-07-12 20:51:52 +08:00
fish 677b860395 添加格式化日志页面跳转 2026-07-12 20:50:00 +08:00
fish 849a5e40e4 添加打开备忘录跳转 2026-07-12 20:47:19 +08:00
fish 65aa5980ac 完成首页设置风格列表 UI 2026-07-12 20:46:29 +08:00
5 changed files with 149 additions and 11 deletions
-2
View File
@@ -150,7 +150,6 @@
INFOPLIST_FILE = Note/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
@@ -183,7 +182,6 @@
INFOPLIST_FILE = Note/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
+53
View File
@@ -0,0 +1,53 @@
//
// FormatLogViewController.swift
// Note
//
// Created by fish on 2026/7/12.
//
import UIKit
class FormatLogViewController: UIViewController {
private var textView: UITextView!
private var formatButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
title = "格式化日志"
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)
])
}
}
+1 -2
View File
@@ -15,8 +15,7 @@
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
+7 -4
View File
@@ -13,10 +13,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
let rootViewController = ViewController()
let navigationController = UINavigationController(rootViewController: rootViewController)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
}
func sceneDidDisconnect(_ scene: UIScene) {
+88 -3
View File
@@ -9,11 +9,96 @@ import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
private var tableView: UITableView!
private struct MenuItem {
let icon: String
let iconColor: UIColor
let title: String
}
private let menuItems: [[MenuItem]] = [
[
MenuItem(icon: "note.text", iconColor: .systemYellow, title: "打开备忘录"),
MenuItem(icon: "doc.text", iconColor: .systemBlue, title: "格式化日志"),
MenuItem(icon: "text.alignleft", iconColor: .systemGreen, title: "格式化笔记")
]
]
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
private func setupUI() {
title = "首页"
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always
view.backgroundColor = .systemGroupedBackground
tableView = UITableView(frame: .zero, style: .insetGrouped)
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.delegate = self
tableView.dataSource = self
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "menuCell")
tableView.backgroundColor = .systemGroupedBackground
view.addSubview(tableView)
NSLayoutConstraint.activate([
tableView.topAnchor.constraint(equalTo: view.topAnchor),
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
}
}
extension ViewController: UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return menuItems.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return menuItems[section].count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "menuCell", for: indexPath)
let item = menuItems[indexPath.section][indexPath.row]
var config = cell.defaultContentConfiguration()
config.text = item.title
config.image = UIImage(systemName: item.icon)
config.imageProperties.tintColor = item.iconColor
config.imageToTextPadding = 12
cell.contentConfiguration = config
cell.accessoryType = .disclosureIndicator
return cell
}
}
extension ViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let item = menuItems[indexPath.section][indexPath.row]
switch item.title {
case "打开备忘录":
openSystemNotesApp()
case "格式化日志":
let viewController = FormatLogViewController()
navigationController?.pushViewController(viewController, animated: true)
default:
break
}
}
private func openSystemNotesApp() {
guard let url = URL(string: "mobilenotes://") else { return }
guard UIApplication.shared.canOpenURL(url) else { return }
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}