Files
real-e-party-iOS/YuMi/E-P/NewMine/Controllers/EPAboutUsViewController.swift
edwinQQQ a0e83658c6 chore: 更新 .gitignore 文件并删除过时的文档
主要变更:
1. 在 .gitignore 中添加了 Docs/ 文件夹,以忽略文档相关文件。
2. 删除了多个过时的文档,包括构建指南、编译修复指南和当前状态报告等。

此更新旨在清理项目文件,确保版本控制的整洁性。
2025-10-16 16:04:15 +08:00

163 lines
5.7 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// EPAboutUsViewController.swift
// YuMi
//
// Created by AI on 2025-01-28.
//
import UIKit
import SnapKit
/// About Us
///
class EPAboutUsViewController: BaseViewController {
// MARK: - UI Components
private lazy var appIconImageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.layer.cornerRadius = 20
imageView.layer.masksToBounds = true
//
if let iconName = Bundle.main.object(forInfoDictionaryKey: "CFBundleIconName") as? String {
imageView.image = UIImage(named: iconName)
} else if let icons = Bundle.main.object(forInfoDictionaryKey: "CFBundleIcons") as? [String: Any],
let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any],
let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String],
let lastIcon = iconFiles.last {
imageView.image = UIImage(named: lastIcon)
} else {
// 使
imageView.image = UIImage(named: "pi_app_logo_new_bg")
}
return imageView
}()
private lazy var appNameLabel: UILabel = {
let label = UILabel()
label.text = Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String
?? Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String
?? "YuMi"
label.textColor = .white
label.font = .systemFont(ofSize: 24, weight: .bold)
label.textAlignment = .center
return label
}()
private lazy var versionLabel: UILabel = {
let label = UILabel()
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "1.0.0"
let build = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "1"
label.text = "Version \(version) (\(build))"
label.textColor = UIColor.white.withAlphaComponent(0.7)
label.font = .systemFont(ofSize: 16)
label.textAlignment = .center
return label
}()
// MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
setupNavigationBar()
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(false, animated: animated)
}
// MARK: - Setup
private func setupNavigationBar() {
title = YMLocalizedString("EPEditSetting.AboutUs")
// iOS 13+
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = UIColor(hex: "#0C0527")
appearance.titleTextAttributes = [
.foregroundColor: UIColor.white,
.font: UIFont.systemFont(ofSize: 18, weight: .medium)
]
appearance.shadowColor = .clear // 线
navigationController?.navigationBar.standardAppearance = appearance
navigationController?.navigationBar.scrollEdgeAppearance = appearance
navigationController?.navigationBar.compactAppearance = appearance
navigationController?.navigationBar.tintColor = .white //
//
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
}
private func setupUI() {
view.backgroundColor = UIColor(hex: "#0C0527")
//
let containerView = UIView()
view.addSubview(containerView)
// UI
containerView.addSubview(appIconImageView)
containerView.addSubview(appNameLabel)
containerView.addSubview(versionLabel)
//
containerView.snp.makeConstraints { make in
make.centerY.equalTo(view).offset(-50) //
make.leading.trailing.equalTo(view).inset(40)
}
//
appIconImageView.snp.makeConstraints { make in
make.top.equalTo(containerView)
make.centerX.equalTo(containerView)
make.size.equalTo(100)
}
//
appNameLabel.snp.makeConstraints { make in
make.top.equalTo(appIconImageView.snp.bottom).offset(24)
make.leading.trailing.equalTo(containerView)
}
//
versionLabel.snp.makeConstraints { make in
make.top.equalTo(appNameLabel.snp.bottom).offset(12)
make.leading.trailing.equalTo(containerView)
}
}
}
// MARK: - UIColor Extension
private extension UIColor {
convenience init(hex: String) {
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
var int: UInt64 = 0
Scanner(string: hex).scanHexInt64(&int)
let a, r, g, b: UInt64
switch hex.count {
case 3: // RGB (12-bit)
(a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)
case 6: // RGB (24-bit)
(a, r, g, b) = (255, int >> 16, int >> 8 & 0xFF, int & 0xFF)
case 8: // ARGB (32-bit)
(a, r, g, b) = (int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF)
default:
(a, r, g, b) = (1, 1, 1, 0)
}
self.init(
red: CGFloat(r) / 255,
green: CGFloat(g) / 255,
blue: CGFloat(b) / 255,
alpha: CGFloat(a) / 255
)
}
}