|
@@ -59,101 +59,101 @@ class TSViewTool: UIView {
|
|
|
let kWapppaperPlaceholderImage = UIImage(named: "wapppaper_placeholder")
|
|
|
let KIconLiveImage = UIImage(named: "icon_live")
|
|
|
|
|
|
-let kSavePhotoSuccesswShared = TSSavePhotoSuccessTool.shared
|
|
|
-class TSSavePhotoSuccessTool {
|
|
|
-
|
|
|
- static let shared = TSSavePhotoSuccessTool()
|
|
|
-
|
|
|
- private lazy var textLabel:UILabel = {
|
|
|
- let textLabel = UILabel()
|
|
|
- textLabel.textColor = "#4A5178".uiColor
|
|
|
- textLabel.text = "Save Successfully".localized
|
|
|
- textLabel.font = UIFont.font(size: 14)
|
|
|
- return textLabel
|
|
|
- }()
|
|
|
-
|
|
|
- private lazy var saveSuccessBg: UIView = {
|
|
|
- return creatSaveSuccessBg()
|
|
|
- }()
|
|
|
-
|
|
|
- func creatSaveSuccessBg() -> UIView {
|
|
|
- let view = UIView()
|
|
|
- view.frame = CGRect(x: 0, y: 0, width: 288, height: 48)
|
|
|
- // 阴影
|
|
|
- view.backgroundColor = .clear
|
|
|
- view.layer.shadowColor = UIColor.black.cgColor
|
|
|
- view.layer.shadowOffset = CGSize(width: 0, height: 2)
|
|
|
- view.layer.shadowOpacity = 0.1
|
|
|
-
|
|
|
- // 圆角
|
|
|
- let colorBg = UIView()
|
|
|
- colorBg.backgroundColor = .white
|
|
|
- colorBg.layer.cornerRadius = 8
|
|
|
- colorBg.layer.masksToBounds = true
|
|
|
- colorBg.clipsToBounds = true
|
|
|
-
|
|
|
- view.addSubview(colorBg)
|
|
|
- colorBg.snp.makeConstraints { make in
|
|
|
- make.leading.trailing.top.bottom.equalTo(0)
|
|
|
- }
|
|
|
-
|
|
|
- let image = UIImage(named: "success_icon")
|
|
|
- let iconView = UIImageView(image: image)
|
|
|
- view.addSubview(iconView)
|
|
|
- iconView.snp.makeConstraints { make in
|
|
|
- make.width.height.equalTo(24)
|
|
|
- make.centerY.equalToSuperview()
|
|
|
- make.leading.equalTo(12)
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- view.addSubview(textLabel)
|
|
|
-
|
|
|
- let viewButton = UIButton.createButton(title: "View".localized ,backgroundColor: "4FEA9D".toColor()?.withAlphaComponent(0.2),font: UIFont.font(size: 14),titleColor: "4FEA9D".toColor(),corner: 14) {
|
|
|
- if let url = URL(string: "photos-redirect://") {
|
|
|
- if UIApplication.shared.canOpenURL(url) {
|
|
|
- UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
|
- playVibration()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- view.addSubview(viewButton)
|
|
|
-
|
|
|
- viewButton.snp.makeConstraints { make in
|
|
|
- make.width.equalTo(65)
|
|
|
- make.height.equalTo(28)
|
|
|
- make.trailing.equalTo(-8)
|
|
|
- make.centerY.equalToSuperview()
|
|
|
- }
|
|
|
-
|
|
|
- textLabel.snp.makeConstraints { make in
|
|
|
- make.leading.equalTo(iconView.snp.trailing).offset(8)
|
|
|
- make.trailing.equalTo(viewButton.snp.leading).offset(-4)
|
|
|
- make.centerY.equalToSuperview()
|
|
|
- }
|
|
|
-
|
|
|
- return view
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- func show(atView:UIView,text:String = "Save Successfully".localized) {
|
|
|
-
|
|
|
- kMainAsync {
|
|
|
- self.textLabel.text = text
|
|
|
- atView.addSubview(self.saveSuccessBg)
|
|
|
- self.saveSuccessBg.snp.remakeConstraints { make in
|
|
|
- make.width.equalTo(288)
|
|
|
- make.height.equalTo(48)
|
|
|
- make.centerX.equalToSuperview()
|
|
|
- make.top.equalTo(k_Height_statusBar()+56.0)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- DispatchQueue.main.asyncAfter(deadline: .now()+5.0) {
|
|
|
- self.saveSuccessBg.removeFromSuperview()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+//let kSaveSuccesswShared = TSSavePhotoSuccessTool.shared
|
|
|
+//class TSSavePhotoSuccessTool {
|
|
|
+//
|
|
|
+// static let shared = TSSavePhotoSuccessTool()
|
|
|
+//
|
|
|
+// private lazy var textLabel:UILabel = {
|
|
|
+// let textLabel = UILabel()
|
|
|
+// textLabel.textColor = "#4A5178".uiColor
|
|
|
+// textLabel.text = "Save Successfully".localized
|
|
|
+// textLabel.font = UIFont.font(size: 14)
|
|
|
+// return textLabel
|
|
|
+// }()
|
|
|
+//
|
|
|
+// private lazy var saveSuccessBg: UIView = {
|
|
|
+// return creatSaveSuccessBg()
|
|
|
+// }()
|
|
|
+//
|
|
|
+// func creatSaveSuccessBg() -> UIView {
|
|
|
+// let view = UIView()
|
|
|
+// view.frame = CGRect(x: 0, y: 0, width: 288, height: 48)
|
|
|
+// // 阴影
|
|
|
+// view.backgroundColor = .clear
|
|
|
+// view.layer.shadowColor = UIColor.black.cgColor
|
|
|
+// view.layer.shadowOffset = CGSize(width: 0, height: 2)
|
|
|
+// view.layer.shadowOpacity = 0.1
|
|
|
+//
|
|
|
+// // 圆角
|
|
|
+// let colorBg = UIView()
|
|
|
+// colorBg.backgroundColor = .white
|
|
|
+// colorBg.layer.cornerRadius = 8
|
|
|
+// colorBg.layer.masksToBounds = true
|
|
|
+// colorBg.clipsToBounds = true
|
|
|
+//
|
|
|
+// view.addSubview(colorBg)
|
|
|
+// colorBg.snp.makeConstraints { make in
|
|
|
+// make.leading.trailing.top.bottom.equalTo(0)
|
|
|
+// }
|
|
|
+//
|
|
|
+// let image = UIImage(named: "success_icon")
|
|
|
+// let iconView = UIImageView(image: image)
|
|
|
+// view.addSubview(iconView)
|
|
|
+// iconView.snp.makeConstraints { make in
|
|
|
+// make.width.height.equalTo(24)
|
|
|
+// make.centerY.equalToSuperview()
|
|
|
+// make.leading.equalTo(12)
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// view.addSubview(textLabel)
|
|
|
+//
|
|
|
+// let viewButton = UIButton.createButton(title: "View".localized ,backgroundColor: "4FEA9D".toColor()?.withAlphaComponent(0.2),font: UIFont.font(size: 14),titleColor: "4FEA9D".toColor(),corner: 14) {
|
|
|
+// if let url = URL(string: "photos-redirect://") {
|
|
|
+// if UIApplication.shared.canOpenURL(url) {
|
|
|
+// UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
|
+// playVibration()
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// view.addSubview(viewButton)
|
|
|
+//
|
|
|
+// viewButton.snp.makeConstraints { make in
|
|
|
+// make.width.equalTo(65)
|
|
|
+// make.height.equalTo(28)
|
|
|
+// make.trailing.equalTo(-8)
|
|
|
+// make.centerY.equalToSuperview()
|
|
|
+// }
|
|
|
+//
|
|
|
+// textLabel.snp.makeConstraints { make in
|
|
|
+// make.leading.equalTo(iconView.snp.trailing).offset(8)
|
|
|
+// make.trailing.equalTo(viewButton.snp.leading).offset(-4)
|
|
|
+// make.centerY.equalToSuperview()
|
|
|
+// }
|
|
|
+//
|
|
|
+// return view
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// func show(atView:UIView,text:String = "Save Successfully".localized) {
|
|
|
+//
|
|
|
+// kMainAsync {
|
|
|
+// self.textLabel.text = text
|
|
|
+// atView.addSubview(self.saveSuccessBg)
|
|
|
+// self.saveSuccessBg.snp.remakeConstraints { make in
|
|
|
+// make.width.equalTo(288)
|
|
|
+// make.height.equalTo(48)
|
|
|
+// make.centerX.equalToSuperview()
|
|
|
+// make.top.equalTo(k_Height_statusBar()+56.0)
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// DispatchQueue.main.asyncAfter(deadline: .now()+5.0) {
|
|
|
+// self.saveSuccessBg.removeFromSuperview()
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//}
|