瀏覽代碼

1.修改点赞方法

wenweiwei 3 年之前
父節點
當前提交
24f01e7c51
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      BFCommonKit/Classes/BFBase/View/PQHeartAnimation.swift

+ 3 - 3
BFCommonKit/Classes/BFBase/View/PQHeartAnimation.swift

@@ -12,13 +12,13 @@ public class PQHeartAnimation: NSObject {
     static let angleArr: [CGFloat] = [CGFloat.pi / 4.0, -CGFloat.pi / 4.0, 0.0]
     var isRepeat: Bool = false
 
-    static public func showAnimation(isRepeat: Bool = false, point: CGPoint, size: CGFloat = 80.0, baseView: UIView, completeHander: @escaping (_ isFinised: Bool) -> Void) {
+    static public func showAnimation(isRepeat: Bool = false, point: CGPoint, size: CGFloat = 80.0, baseView: UIView,imageName:String? = nil, completeHander: @escaping (_ isFinised: Bool) -> Void) {
         if isRepeat, baseView.viewWithTag(cHeartTag) != nil {
             return
         }
         let imgV = UIImageView(frame: CGRect(x: point.x - size / 2.0, y: point.y - size / 2.0, width: size, height: size))
         imgV.tag = cHeartTag
-        imgV.image = UIImage.moduleImage(named: "ic_heart", moduleName: "BFCommonKit")
+        imgV.image = (imageName != nil && (imageName?.count ?? 0) > 0) ? UIImage.init(named: imageName!) :  UIImage.moduleImage(named: "ic_heart", moduleName: "BFCommonKit")
         imgV.contentMode = .scaleAspectFill
         baseView.addSubview(imgV)
 
@@ -36,7 +36,7 @@ public class PQHeartAnimation: NSObject {
         animation.values = [1.3, 0.8, 1.0]
         imgV.layer.add(animation, forKey: "transform.scale")
 
-        UIView.animate(withDuration: 1, delay: 0.5, options: .layoutSubviews, animations: {
+        UIView.animate(withDuration: 1, delay: 0.5, options: .allowUserInteraction, animations: {
             imgV.alpha = 0.0
             var newFrame = imgV.frame
             newFrame.origin.x -= (isRepeat ? -cDefaultMargin * 2 : cDefaultMargin)