         }
     }
     
-    override func layoutSubviews() {
-        super.layoutSubviews()
+    func updateLayout() {
         selectedImageView.frame = bounds
         selectedImageView.layer.cornerRadius = selectedImageView.bounds.size.width * 0.5
-        
         imageView.bounds = CGRect(x: 0, y: 0, width: groupDimension, height: groupDimension)
         imageView.center = CGPoint(x: 0.5*bounds.size.width, y: 0.5*bounds.size.height)
         imageView.layer.cornerRadius = imageView.bounds.size.width * 0.5
-        
         if countLabel.text != nil {
             imageView.isHidden = true
             dotView.bounds = CGRect(x: 0, y: 0, width: groupDimension, height: groupDimension)

    var alwaysShowImage = false
    
    func set(alwaysShowImage: Bool, animated: Bool) {
        if alwaysShowImage {
            imageView.alpha = 0
            imageView.transform = CGAffineTransform(scaleX: 0.5, y: 0.5)
        } else {
            imageView.alpha = 1
        }
        let animations = {
            if alwaysShowImage {
                self.imageView.alpha = 1
                self.imageView.transform = CGAffineTransform.identity
            } else {
                self.imageView.alpha = 0
                self.imageView.transform = CGAffineTransform(scaleX: 0.5, y: 0.5)
            }
        }
        if (animated) {

        set(alwaysShowImage: false, animated: false)
        selectedImageView.alpha = 0
        selectedImageView.transform = CGAffineTransform.identity
        dotView.transform = CGAffineTransform.identity
        dotView.alpha = 1
        imageView.alpha = 0
        imageView.transform = CGAffineTransform.identity
        alpha = 1
