     }
     
     public func setImage(with urlString: String?, for state: UIControlState, placeholder: UIImage? = nil, completion: ((UIImage?, NSError?) -> Void)? = nil) {
-        clearImage()
-        setImage(placeholder, for: [])
+        clearImage(state: state)
+        setImage(placeholder, for: state)
         
         if let urlString = urlString, let url = URL(string: urlString) {
             sd_setImage(with: url, for: state, completed: { [weak self] (image, error, type, url) in

}

public extension UIButton {
    public func clearImage() {
        sd_cancelImageLoad(for: [])
        setImage(nil, for: [])
        setBackgroundImage(nil, for: [])
    }
    
    public func setBackgroundImage(with urlString: String?, for state: UIControlState, placeholder: UIImage? = nil, completion: ((UIImage?, NSError?) -> Void)? = nil) {
        clearImage()
        setBackgroundImage(placeholder, for: [])
        
        if let urlString = urlString, let url = URL(string: urlString) {
            sd_setBackgroundImage(with: url, for: state, completed: { [weak self] (image, error, type, url) in

}

public extension NSLayoutConstraint {
    public class func constraints(withVisualFormat format: String, views: [String : Any]) -> [NSLayoutConstraint] {
        return NSLayoutConstraint.constraints(withVisualFormat: format, options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views)
    }
}
