Touches when click a button

Hello, everybody, I have a problem in my application, I have a button with touch down and touch up inside, whe I click the button show me a view rating and when put down the view are dissapear, but the rating inside of view don't full the stars when pass the mouse over there, this is my code


import UIKit

class ViewController: UIViewController{
    
    @IBOutlet weak var button2: UIButton!
    @IBOutlet weak var PopUpView: UIView!
    @IBOutlet weak var floatRatingView: FloatRatingView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        PopUpView.hidden = true
        PopUpView.layer.cornerRadius = 5
        PopUpView.layer.masksToBounds = true
        
        self.floatRatingView.emptyImage = UIImage(named: "emptyStar")
        self.floatRatingView.fullImage = UIImage(named: "filledStar")
        self.floatRatingView.contentMode = UIViewContentMode.ScaleAspectFit
        self.floatRatingView.maxRating = 5
        self.floatRatingView.minRating = 0
        self.floatRatingView.editable = true
        
    }
    @IBAction func Down(sender: AnyObject) {
        PopUpView.hidden = false
        PopUpView.alpha = 1
        cal()
    }
    
    @IBAction func closeRating(sender: AnyObject) {
        PopUpView.hidden = true
        PopUpView.alpha = 0
        cal()
    }
    
    func cal(){
        if floatRatingView.rating < 1{
            let image = UIImage(named: "emptyStar") as UIImage!
            self.button2.setImage(image, forState: .Normal)
        } else {
            let image = UIImage(named: "filledStar") as UIImage!
            self.button2.setImage(image, forState: .Normal)
        }
    }
    
}


This is the code of floatRatingView


import UIKit

@objc public protocol FloatRatingViewDelegate {
    /*
    Returns the rating value when touch events end
    */
    func floatRatingView(ratingView: FloatRatingView, didUpdate rating: Float)
    
    /*
    Returns the rating value as the user pans
    */
    optional func floatRatingView(ratingView: FloatRatingView, isUpdating rating: Float)
}

/*
A simple rating view that can set whole, half or floating point ratings.
*/
@IBDesignable
public class FloatRatingView: UIView {
    
    /               maskLayer.frame = CGRectMake(0, 0, CGFloat(self.rating-Float(i))*imageView.frame.size.width, imageView.frame.size.height)
                maskLayer.backgroundColor = UIColor.blackColor().CGColor
                imageView.layer.mask = maskLayer
                imageView.hidden = false
            }
            else {
                imageView.layer.mask = nil;
                imageView.hidden = true
            }
        }
    }
    
    /               let imageFrame = CGRectMake(i==0 ? 0:CGFloat(i)*(imageXOffset+imageViewSize.width), 0, imageViewSize.width, imageViewSize.height)
                
                var imageView = self.emptyImageViews[i]
                imageView.frame = imageFrame
                
                imageView = self.fullImageViews[i]
                imageView.frame = imageFrame
            }
            
            self.refresh()
        }
    }
    
    func removeImageViews() {
        // Remove old image views
        for i in 0..<self.emptyImageViews.count {
            var imageView = self.emptyImageViews[i]
            imageView.removeFromSuperview()
            imageView = self.fullImageViews[i]
            imageView.removeFromSuperview()
        }
        self.emptyImageViews.removeAll(keepCapacity: false)
        self.fullImageViews.removeAll(keepCapacity: false)
    }
    
    func initImageViews() {
        if self.emptyImageViews.count != 0 {
            return
        }
        
        // Add new image views
        for _ in 0..<self.maxRating {
            let emptyImageView = UIImageView()
            emptyImageView.contentMode = self.imageContentMode
            emptyImageView.image = self.emptyImage
            self.emptyImageViews.append(emptyImageView)
            self.addSubview(emptyImageView)
            
            let fullImageView = UIImageView()
            fullImageView.contentMode = self.imageContentMode
            fullImageView.image = self.fullImage
            self.fullImageViews.append(fullImageView)
            self.addSubview(fullImageView)
        }
    }
    
    // MARK: Touch events
    
    // Calculates new rating based on touch location in view
    func handleTouchAtLocation(touchLocation: CGPoint) {
        if !self.editable {
            return
        }
        
        var newRating: Float = 0
        for i in (self.maxRating-1).stride(through: 0, by: -1) {
            let imageView = self.emptyImageViews[i]
            if touchLocation.x > imageView.frame.origin.x {
                // Find touch point in image view
                let newLocation = imageView.convertPoint(touchLocation, fromView:self)
                
                // Find decimal value for float or half rating
                if imageView.pointInside(newLocation, withEvent: nil) && (self.floatRatings) {
                    let decimalNum = Float(newLocation.x / imageView.frame.size.width)
                    newRating = Float(i) + decimalNum
                }
                    // Whole rating
                else {
                    newRating = Float(i) + 1.0
                }
                break
            }
        }
        
        // Check min rating
        self.rating = newRating < Float(self.minRating) ? Float(self.minRating):newRating
        
        // Update delegate
        if let delegate = self.delegate {
            delegate.floatRatingView?(self, isUpdating: self.rating)
        }
    }
    
    override public func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        if let touch = touches.first {
            let touchLocation = touch.locationInView(self)
            self.handleTouchAtLocation(touchLocation)
        }
    }
    
    override public func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
        if let touch = touches.first  {
            let touchLocation = touch.locationInView(self)
            self.handleTouchAtLocation(touchLocation)
        }
    }
    
    override public func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
        // Update delegate
        if let delegate = self.delegate {
            delegate.floatRatingView(self, didUpdate: self.rating)
        }
    }
    
}



Please, help me

Touches when click a button
 
 
Q