Commit 79168f09 authored by David黄金龙's avatar David黄金龙

1、图片替换

2、完善逻辑
parent 7a27f734
...@@ -7,17 +7,15 @@ ...@@ -7,17 +7,15 @@
// //
import UIKit import UIKit
import AttributedString
class YHOffivialApprovalSuccessCheckView: UIView { class YHOffivialApprovalSuccessCheckView: UIView {
lazy var blackMaskView: UIView = { lazy var blackMaskView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.6) view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.6)
let tap = UITapGestureRecognizer(target: self, action: #selector(dismiss))
view.addGestureRecognizer(tap)
return view return view
}() }()
//香港身份获批指引操作 //香港身份获批指引操作
lazy var rewardBtn: UIButton = { lazy var rewardBtn: UIButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
...@@ -26,6 +24,13 @@ class YHOffivialApprovalSuccessCheckView: UIView { ...@@ -26,6 +24,13 @@ class YHOffivialApprovalSuccessCheckView: UIView {
return button return button
}() }()
lazy var closeBtn: UIButton = {
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(clickCloseBtn), for: .touchUpInside)
button.setImage(UIImage(named: "official_approval_close_btn"), for: .normal)
return button
}()
lazy var bkgImageV: UIImageView = { lazy var bkgImageV: UIImageView = {
let imageV = UIImageView() let imageV = UIImageView()
imageV.image = UIImage(named: "official_approval_bkg") imageV.image = UIImage(named: "official_approval_bkg")
...@@ -34,7 +39,6 @@ class YHOffivialApprovalSuccessCheckView: UIView { ...@@ -34,7 +39,6 @@ class YHOffivialApprovalSuccessCheckView: UIView {
return imageV return imageV
}() }()
lazy var holdView: UIView = { lazy var holdView: UIView = {
let view = UIView() let view = UIView()
return view return view
...@@ -43,8 +47,7 @@ class YHOffivialApprovalSuccessCheckView: UIView { ...@@ -43,8 +47,7 @@ class YHOffivialApprovalSuccessCheckView: UIView {
lazy var titleLabel: UILabel = { lazy var titleLabel: UILabel = {
var label = UILabel() var label = UILabel()
label.font = .PFSC_R(ofSize: 14) label.font = .PFSC_R(ofSize: 15)
// label.textAlignment = .center
label.textColor = UIColor(hex: 0x671908, alpha: 1.0) label.textColor = UIColor(hex: 0x671908, alpha: 1.0)
label.text = "" label.text = ""
label.numberOfLines = 0 label.numberOfLines = 0
...@@ -53,8 +56,6 @@ class YHOffivialApprovalSuccessCheckView: UIView { ...@@ -53,8 +56,6 @@ class YHOffivialApprovalSuccessCheckView: UIView {
}() }()
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
...@@ -68,7 +69,6 @@ class YHOffivialApprovalSuccessCheckView: UIView { ...@@ -68,7 +69,6 @@ class YHOffivialApprovalSuccessCheckView: UIView {
var timer: Timer? var timer: Timer?
var counter = 0 var counter = 0
// var text = "打字机效果展示"
} }
extension YHOffivialApprovalSuccessCheckView { extension YHOffivialApprovalSuccessCheckView {
...@@ -87,6 +87,10 @@ extension YHOffivialApprovalSuccessCheckView { ...@@ -87,6 +87,10 @@ extension YHOffivialApprovalSuccessCheckView {
} }
@objc func clickSureBtn() { @objc func clickSureBtn() {
YHHUD.flash(message: "点击了 xx")
}
@objc func clickCloseBtn() {
dismiss() dismiss()
} }
} }
...@@ -126,18 +130,19 @@ private extension YHOffivialApprovalSuccessCheckView { ...@@ -126,18 +130,19 @@ private extension YHOffivialApprovalSuccessCheckView {
} }
holdView.addSubview(closeBtn)
closeBtn.snp.makeConstraints { make in
make.top.equalTo(rewardBtn.snp.bottom).offset(156)
make.width.equalTo(24)
make.height.equalTo(24)
make.centerX.equalToSuperview()
}
closeBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
UIView.animate(withDuration: 1) { UIView.animate(withDuration: 1) {
self.holdView.frame = CGRect(x: 0, y: (KScreenHeight-imageH)/2, width: KScreenWidth, height: imageH) self.holdView.frame = CGRect(x: 0, y: (KScreenHeight-imageH)/2 + 20, width: KScreenWidth, height: imageH)
} completion: { flag in } completion: { flag in
self.titleLabel.isHidden = false self.titleLabel.isHidden = false
// self.typewriterEffect(text: self.testContent) { finishedText in
// print("打字完成: \(finishedText)")
//
// }
self.startTyping() self.startTyping()
} }
...@@ -152,24 +157,16 @@ private extension YHOffivialApprovalSuccessCheckView { ...@@ -152,24 +157,16 @@ private extension YHOffivialApprovalSuccessCheckView {
@objc func typeText() { @objc func typeText() {
if counter < testContent.count { if counter < testContent.count {
let char = testContent[testContent.index(testContent.startIndex, offsetBy: counter)]
self.titleLabel.text = String(testContent.prefix(counter + 1)) self.titleLabel.text = String(testContent.prefix(counter + 1))
counter += 1 counter += 1
} else { } else {
timer?.invalidate() timer?.invalidate()
counter = 0 counter = 0
let paragraphStyle = NSMutableParagraphStyle() let aa: ASAttributedString = .init("恭喜您申请的【优秀人才入境计划】", .font(UIFont.PFSC_R(ofSize: 15)),.foreground(UIColor(hex: 0x671908, alpha: 1.0)))
paragraphStyle.lineSpacing = 6 // 设置行间距 let bb: ASAttributedString = .init("已获得港府的正式批准!", .font(UIFont.PFSC_R(ofSize: 15)),.foreground(UIColor(hex: 0xAE1616, alpha: 1.0)))
paragraphStyle.alignment = .center let cc: ASAttributedString = .init("从递交资料伊始,经历了235天,感谢您这一路以来对银河的信赖与包容!", .font(UIFont.PFSC_R(ofSize: 15)),.foreground(UIColor(hex: 0x671908, alpha: 1.0)))
let attributes: [NSAttributedString.Key: Any] = [ self.titleLabel.attributed.text = aa + bb + cc
.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
} }
} }
} }
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "Group 2033194865@2x.png", "filename" : "弹窗-信封@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "Group 2033194865@3x.png", "filename" : "弹窗-信封@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
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