From 8f2152dc1852e6b81b86ecb78a5411b4915debe6 Mon Sep 17 00:00:00 2001 From: fish Date: Mon, 20 Jul 2026 21:52:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E6=8C=89=E9=92=AE=E6=94=B9?= =?UTF-8?q?=E7=94=A8=20iOS=2026=20=E5=8E=9F=E7=94=9F=20Liquid=20Glass=20AP?= =?UTF-8?q?I?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- .../Views/SpellingInputView.swift | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/LearnEnglish/LearnEnglish/Views/SpellingInputView.swift b/LearnEnglish/LearnEnglish/Views/SpellingInputView.swift index 6113f86..0ce88c7 100644 --- a/LearnEnglish/LearnEnglish/Views/SpellingInputView.swift +++ b/LearnEnglish/LearnEnglish/Views/SpellingInputView.swift @@ -61,27 +61,16 @@ final class SpellingInputView: UIView, UITextFieldDelegate { accessory.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 52) accessory.backgroundColor = .clear - let glassButton = UIButton(type: .custom) - glassButton.layer.cornerRadius = 14 - glassButton.layer.borderWidth = 0.5 - glassButton.layer.borderColor = UIColor(white: 1, alpha: 0.6).cgColor - glassButton.clipsToBounds = true - - let renderer = UIGraphicsImageRenderer(size: CGSize(width: 60, height: 44)) - let bgImage = renderer.image { ctx in - let gradient = CGGradient( - colorsSpace: CGColorSpaceCreateDeviceRGB(), - colors: [UIColor(red: 0.6, green: 0.75, blue: 0.95, alpha: 0.7).cgColor, UIColor(red: 0.3, green: 0.55, blue: 0.85, alpha: 0.45).cgColor] as CFArray, - locations: [0, 0.5] - )! - ctx.cgContext.drawLinearGradient(gradient, - start: CGPoint(x: 0, y: 0), end: CGPoint(x: 0, y: 44), options: []) + var glassConfig = UIButton.Configuration.glass() + glassConfig.title = "确认" + glassConfig.cornerStyle = .fixed + glassConfig.baseForegroundColor = .white + glassConfig.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in + var outgoing = incoming + outgoing.font = .systemFont(ofSize: 16, weight: .semibold) + return outgoing } - glassButton.setBackgroundImage(bgImage, for: .normal) - - glassButton.setTitle("确认", for: .normal) - glassButton.setTitleColor(.white, for: .normal) - glassButton.titleLabel?.font = .systemFont(ofSize: 16, weight: .semibold) + let glassButton = UIButton(configuration: glassConfig) glassButton.addAction(UIAction { [weak self] _ in self?.onSubmit?() }, for: .touchUpInside)