diff --git a/Veloria/Base/Extension/UIColor+VPAdd.swift b/Veloria/Base/Extension/UIColor+VPAdd.swift index eea58c0..6e05cda 100644 --- a/Veloria/Base/Extension/UIColor+VPAdd.swift +++ b/Veloria/Base/Extension/UIColor+VPAdd.swift @@ -101,4 +101,8 @@ extension UIColor { static func colorB5B5B5(alpha: CGFloat = 1) -> UIColor { return UIColor(rgb: 0xB5B5B5, alpha: alpha) } + + static func colorC4C4C4(alpha: CGFloat = 1) -> UIColor { + return UIColor(rgb: 0xC4C4C4, alpha: alpha) + } } diff --git a/Veloria/Base/View/VPImageView.swift b/Veloria/Base/View/VPImageView.swift index 3054089..f6fa9eb 100644 --- a/Veloria/Base/View/VPImageView.swift +++ b/Veloria/Base/View/VPImageView.swift @@ -9,7 +9,14 @@ import UIKit class VPImageView: UIImageView { - var placeholderColor = UIColor.gray + var placeholderColor = UIColor.colorC4C4C4() + + private lazy var placeholderImageView: UIImageView = { + let imageView = UIImageView(image: UIImage(named: "placeholder_image_01")) + imageView.isHidden = true + imageView.contentMode = .scaleAspectFit + return imageView + }() override init(frame: CGRect) { super.init(frame: frame) @@ -36,7 +43,10 @@ class VPImageView: UIImageView { self.layer.masksToBounds = true if image == nil { self.backgroundColor = self.placeholderColor + placeholderImageView.isHidden = false } + + addSubview(placeholderImageView) } override var image: UIImage? { @@ -48,7 +58,20 @@ class VPImageView: UIImageView { self.backgroundColor = nil } } + + if image == nil { + placeholderImageView.isHidden = false + } else { + placeholderImageView.isHidden = true + } } } + + override func layoutSubviews() { + super.layoutSubviews() + + placeholderImageView.frame = .init(x: 0, y: 0, width: self.bounds.width * (2 / 3), height: self.bounds.height * (2 / 3)) + placeholderImageView.center = .init(x: self.bounds.width / 2, y: self.bounds.height / 2) + } } diff --git a/Veloria/Class/Home/Controller/VPSearchViewController.swift b/Veloria/Class/Home/Controller/VPSearchViewController.swift index b41c08a..1b0579a 100644 --- a/Veloria/Class/Home/Controller/VPSearchViewController.swift +++ b/Veloria/Class/Home/Controller/VPSearchViewController.swift @@ -47,8 +47,8 @@ class VPSearchViewController: VPViewController { vp_setupUI() vp_addAction() - let tap = UITapGestureRecognizer(target: self, action: #selector(handleScreen)) - self.view.addGestureRecognizer(tap) +// let tap = UITapGestureRecognizer(target: self, action: #selector(handleScreen)) +// self.view.addGestureRecognizer(tap) } diff --git a/Veloria/Source/Assets.xcassets/image/placeholder_image_01.imageset/Contents.json b/Veloria/Source/Assets.xcassets/image/placeholder_image_01.imageset/Contents.json new file mode 100644 index 0000000..fb48581 --- /dev/null +++ b/Veloria/Source/Assets.xcassets/image/placeholder_image_01.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "加载占位图-切图图标@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "加载占位图-切图图标@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Veloria/Source/Assets.xcassets/image/placeholder_image_01.imageset/加载占位图-切图图标@2x.png b/Veloria/Source/Assets.xcassets/image/placeholder_image_01.imageset/加载占位图-切图图标@2x.png new file mode 100644 index 0000000..636b6fb Binary files /dev/null and b/Veloria/Source/Assets.xcassets/image/placeholder_image_01.imageset/加载占位图-切图图标@2x.png differ diff --git a/Veloria/Source/Assets.xcassets/image/placeholder_image_01.imageset/加载占位图-切图图标@3x.png b/Veloria/Source/Assets.xcassets/image/placeholder_image_01.imageset/加载占位图-切图图标@3x.png new file mode 100644 index 0000000..76b9feb Binary files /dev/null and b/Veloria/Source/Assets.xcassets/image/placeholder_image_01.imageset/加载占位图-切图图标@3x.png differ diff --git a/app账号信息.txt b/资料/app账号信息.txt similarity index 100% rename from app账号信息.txt rename to 资料/app账号信息.txt diff --git a/资料/授权文件/WechatIMG1.jpg b/资料/授权文件/WechatIMG1.jpg new file mode 100644 index 0000000..8d537b8 Binary files /dev/null and b/资料/授权文件/WechatIMG1.jpg differ