Commit 7a27f734 authored by David黄金龙's avatar David黄金龙

打字效果

parent ac4491f2
...@@ -599,6 +599,7 @@ ...@@ -599,6 +599,7 @@
A5F886BA2C62475C00B63CF5 /* YHOfficialApprovalResultVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F886B92C62475C00B63CF5 /* YHOfficialApprovalResultVC.swift */; }; A5F886BA2C62475C00B63CF5 /* YHOfficialApprovalResultVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F886B92C62475C00B63CF5 /* YHOfficialApprovalResultVC.swift */; };
A5F8AC082B9F414000A21EFA /* YHCustomTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F8AC072B9F414000A21EFA /* YHCustomTextView.swift */; }; A5F8AC082B9F414000A21EFA /* YHCustomTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F8AC072B9F414000A21EFA /* YHCustomTextView.swift */; };
A5F9E9F72C637FC5005BCA73 /* YHOffivialApprovalGuildLineCheckView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F9E9F62C637FC5005BCA73 /* YHOffivialApprovalGuildLineCheckView.swift */; }; A5F9E9F72C637FC5005BCA73 /* YHOffivialApprovalGuildLineCheckView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F9E9F62C637FC5005BCA73 /* YHOffivialApprovalGuildLineCheckView.swift */; };
A5F9E9FA2C63A673005BCA73 /* YHOffivialApprovalSuccessCheckView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F9E9F92C63A673005BCA73 /* YHOffivialApprovalSuccessCheckView.swift */; };
A5FD45232C523DD300908AD9 /* YHJsApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FD45222C523DD300908AD9 /* YHJsApi.swift */; }; A5FD45232C523DD300908AD9 /* YHJsApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FD45222C523DD300908AD9 /* YHJsApi.swift */; };
A5FD63BD2B623C2C00D1D9DA /* YHInformationPerfectListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FD63BC2B623C2C00D1D9DA /* YHInformationPerfectListVC.swift */; }; A5FD63BD2B623C2C00D1D9DA /* YHInformationPerfectListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FD63BC2B623C2C00D1D9DA /* YHInformationPerfectListVC.swift */; };
A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FD63BE2B6250BC00D1D9DA /* YHInformationPerfectCell.swift */; }; A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FD63BE2B6250BC00D1D9DA /* YHInformationPerfectCell.swift */; };
...@@ -1248,6 +1249,7 @@ ...@@ -1248,6 +1249,7 @@
A5F886B92C62475C00B63CF5 /* YHOfficialApprovalResultVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOfficialApprovalResultVC.swift; sourceTree = "<group>"; }; A5F886B92C62475C00B63CF5 /* YHOfficialApprovalResultVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOfficialApprovalResultVC.swift; sourceTree = "<group>"; };
A5F8AC072B9F414000A21EFA /* YHCustomTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHCustomTextView.swift; sourceTree = "<group>"; }; A5F8AC072B9F414000A21EFA /* YHCustomTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHCustomTextView.swift; sourceTree = "<group>"; };
A5F9E9F62C637FC5005BCA73 /* YHOffivialApprovalGuildLineCheckView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOffivialApprovalGuildLineCheckView.swift; sourceTree = "<group>"; }; A5F9E9F62C637FC5005BCA73 /* YHOffivialApprovalGuildLineCheckView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOffivialApprovalGuildLineCheckView.swift; sourceTree = "<group>"; };
A5F9E9F92C63A673005BCA73 /* YHOffivialApprovalSuccessCheckView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOffivialApprovalSuccessCheckView.swift; sourceTree = "<group>"; };
A5FD45222C523DD300908AD9 /* YHJsApi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHJsApi.swift; sourceTree = "<group>"; }; A5FD45222C523DD300908AD9 /* YHJsApi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHJsApi.swift; sourceTree = "<group>"; };
A5FD63BC2B623C2C00D1D9DA /* YHInformationPerfectListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInformationPerfectListVC.swift; sourceTree = "<group>"; }; A5FD63BC2B623C2C00D1D9DA /* YHInformationPerfectListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInformationPerfectListVC.swift; sourceTree = "<group>"; };
A5FD63BE2B6250BC00D1D9DA /* YHInformationPerfectCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInformationPerfectCell.swift; sourceTree = "<group>"; }; A5FD63BE2B6250BC00D1D9DA /* YHInformationPerfectCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInformationPerfectCell.swift; sourceTree = "<group>"; };
...@@ -3339,6 +3341,7 @@ ...@@ -3339,6 +3341,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A5F9E9F62C637FC5005BCA73 /* YHOffivialApprovalGuildLineCheckView.swift */, A5F9E9F62C637FC5005BCA73 /* YHOffivialApprovalGuildLineCheckView.swift */,
A5F9E9F92C63A673005BCA73 /* YHOffivialApprovalSuccessCheckView.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3765,6 +3768,7 @@ ...@@ -3765,6 +3768,7 @@
04174D642BCD52BD000BA46D /* YHDeviceInfoViewController.swift in Sources */, 04174D642BCD52BD000BA46D /* YHDeviceInfoViewController.swift in Sources */,
0472E25E2C534723008EAB6E /* YHLifeDetailViewController.swift in Sources */, 0472E25E2C534723008EAB6E /* YHLifeDetailViewController.swift in Sources */,
A5ACE92E2B4564F7002C94D2 /* YHValidateCodeInputView.swift in Sources */, A5ACE92E2B4564F7002C94D2 /* YHValidateCodeInputView.swift in Sources */,
A5F9E9FA2C63A673005BCA73 /* YHOffivialApprovalSuccessCheckView.swift in Sources */,
045EEED82B9F171A0022A143 /* YHQuestionInfo.swift in Sources */, 045EEED82B9F171A0022A143 /* YHQuestionInfo.swift in Sources */,
A567E5B82BD7643D00D5D5A0 /* YHSearchItemLayout.swift in Sources */, A567E5B82BD7643D00D5D5A0 /* YHSearchItemLayout.swift in Sources */,
A567E5A02BD7643D00D5D5A0 /* YHHomeWebViewController.swift in Sources */, A567E5A02BD7643D00D5D5A0 /* YHHomeWebViewController.swift in Sources */,
......
...@@ -61,7 +61,10 @@ private extension YHOfficialApprovalResultVC { ...@@ -61,7 +61,10 @@ private extension YHOfficialApprovalResultVC {
@objc func clickRightItemBtn() { @objc func clickRightItemBtn() {
let view = YHOffivialApprovalGuildLineCheckView.sheetView() // let view = YHOffivialApprovalGuildLineCheckView.sheetView()
// view.show()
let view = YHOffivialApprovalSuccessCheckView.sheetView()
view.show() view.show()
} }
......
//
// YHOffivialApprovalSuccessCheckView.swift
// galaxy
//
// Created by davidhuangA on 2024/8/7.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHOffivialApprovalSuccessCheckView: UIView {
lazy var blackMaskView: UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.6)
let tap = UITapGestureRecognizer(target: self, action: #selector(dismiss))
view.addGestureRecognizer(tap)
return view
}()
//香港身份获批指引操作
lazy var rewardBtn: UIButton = {
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(clickSureBtn), for: .touchUpInside)
button.setImage(UIImage(named: "official_approval_btn"), for: .normal)
return button
}()
lazy var bkgImageV: UIImageView = {
let imageV = UIImageView()
imageV.image = UIImage(named: "official_approval_bkg")
imageV.contentMode = .scaleToFill
imageV.clipsToBounds = true
return imageV
}()
lazy var holdView: UIView = {
let view = UIView()
return view
}()
lazy var titleLabel: UILabel = {
var label = UILabel()
label.font = .PFSC_R(ofSize: 14)
// label.textAlignment = .center
label.textColor = UIColor(hex: 0x671908, alpha: 1.0)
label.text = ""
label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping
return label
}()
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
let testContent = "恭喜您申请的【优秀人才入境计划】已获得港府的正式批准!从递交资料伊始,经历了235天,感谢您这一路以来对银河的信赖与包容!"
var timer: Timer?
var counter = 0
// var text = "打字机效果展示"
}
extension YHOffivialApprovalSuccessCheckView {
static func sheetView() -> YHOffivialApprovalSuccessCheckView {
let view = YHOffivialApprovalSuccessCheckView(frame:UIScreen.main.bounds)
return view
}
func show() {
UIApplication.shared.yhKeyWindow()?.addSubview(self)
}
@objc func dismiss() {
self.removeFromSuperview()
}
@objc func clickSureBtn() {
dismiss()
}
}
private extension YHOffivialApprovalSuccessCheckView {
func setupUI() {
addSubview(blackMaskView)
blackMaskView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
if let tmpImage = UIImage(named:"official_approval_bkg") {
let scale = Double(tmpImage.size.height / tmpImage.size.width)
let imageH = scale * KScreenWidth
holdView.frame = CGRect(x: 0, y: KScreenHeight, width: KScreenWidth, height: imageH)
addSubview(holdView)
bkgImageV.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: imageH)
holdView.addSubview(bkgImageV)
holdView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.top.equalTo(112)
make.left.equalTo(64)
make.right.equalTo(-64)
}
titleLabel.isHidden = true
holdView.addSubview(rewardBtn)
rewardBtn.snp.makeConstraints { make in
make.top.equalTo(233)
make.width.equalTo(188)
make.height.equalTo(36)
make.centerX.equalToSuperview()
}
UIView.animate(withDuration: 1) {
self.holdView.frame = CGRect(x: 0, y: (KScreenHeight-imageH)/2, width: KScreenWidth, height: imageH)
} completion: { flag in
self.titleLabel.isHidden = false
// self.typewriterEffect(text: self.testContent) { finishedText in
// print("打字完成: \(finishedText)")
//
// }
self.startTyping()
}
}
}
func startTyping() {
timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(typeText), userInfo: nil, repeats: true)
RunLoop.current.add(timer!, forMode: .common)
}
@objc func typeText() {
if counter < testContent.count {
let char = testContent[testContent.index(testContent.startIndex, offsetBy: counter)]
self.titleLabel.text = String(testContent.prefix(counter + 1))
counter += 1
} else {
timer?.invalidate()
counter = 0
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 6 // 设置行间距
paragraphStyle.alignment = .center
let attributes: [NSAttributedString.Key: Any] = [
.paragraphStyle: paragraphStyle,
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor:UIColor(hex: 0x671908, alpha: 1.0)
]
let attributedString = NSAttributedString(string: self.testContent, attributes: attributes)
self.titleLabel.attributedText = attributedString
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment