TSViewTool.swift 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // TSViewTool.swift
  3. // TSLiveWallpaper
  4. //
  5. // Created by 100Years on 2024/12/20.
  6. //
  7. class TSViewTool: UIView {
  8. }
  9. func createBlurEffectView(style:UIBlurEffect.Style,backgroundColor:UIColor? = nil) -> UIVisualEffectView {
  10. let blurEffect = UIBlurEffect(style: style)
  11. let blurEffectView = UIVisualEffectView(effect: blurEffect)
  12. blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
  13. if backgroundColor != nil {
  14. blurEffectView.backgroundColor = backgroundColor
  15. }
  16. return blurEffectView
  17. }
  18. //常用提交按钮
  19. func kCreateNormalSubmitBtn(title:String, action: (() -> Void)? = nil) -> UIButton {
  20. let btn = TSNormalSubmitBtn()
  21. btn.setUpButton(title:title,font: UIFont.font(size: 16,weight: .regular),titleColor:.white,corner: 24,action: action)
  22. btn.contentEdgeInsets = UIEdgeInsets(top: 0, left: 8, bottom: 0, right: 0)
  23. btn.imageEdgeInsets = UIEdgeInsets(top:0, left: -8, bottom: 0, right: 16)
  24. btn.frame = CGRectMake(0, 0, 200, 48)
  25. btn.addGradientBg(colors: ["#E961F6".uiColor.cgColor,"#7E57F4".uiColor.cgColor])
  26. return btn
  27. }
  28. func kAddNormalSubmitGradientBg(view:UIView){
  29. kDelayMainShort {
  30. view.addGradientBg(colors: ["#E961F6".uiColor.cgColor,"#7E57F4".uiColor.cgColor])
  31. }
  32. }
  33. func kCreateMoreInfoBtn() -> UIButton{
  34. let btn = TSUIExpandedTouchButton()
  35. btn.setImage(UIImage(named: "more_info_white"), for: .normal)
  36. return btn
  37. }
  38. ////常用提交按钮
  39. //func kCreateNormalSubmitBtn(title:String, action: (() -> Void)? = nil) -> UIButton {
  40. // let btn = UIButton.createButton(title:title,backgroundColor: .black,font: UIFont.font(size: 16,weight: .regular),titleColor:.themeColor,corner: 24,action: action)
  41. // btn.layer.borderWidth = 1
  42. // btn.layer.borderColor = UIColor.themeColor.cgColor
  43. // btn.frame = CGRectMake(0, 0, 200, 48)
  44. // return btn
  45. //}
  46. ////常用取消按钮
  47. //func kCreateNormalCancelBtn(title:String, action: (() -> Void)? = nil) -> UIButton {
  48. // let btn = UIButton.createButton(title:title,backgroundColor: .fromHex("#FFFFFF", alpha: 0.4),font: UIFont.font(size: 14,weight: .medium),titleColor:.white,corner: 30,action: action)
  49. // return btn
  50. //}
  51. ////常用确定按钮
  52. //func kCreateNormalConfirmBtn(title:String, action: (() -> Void)? = nil) -> UIButton {
  53. // let btn = UIButton.createButton(title:title,backgroundImage:UIImage(named: "submit_btn_small_bg"),font: UIFont.font(size: 14,weight: .medium),titleColor:.white,corner: 30,action: action)
  54. // return btn
  55. //}
  56. let kPlaceholderImage = UIImage(named: "placeholderImage")
  57. let kViewBJ = "view_bj"