ios 在使用 SDWebimage UIButton setBackgroundimage

时间:2022-12-06 06:18:46

解决方法 :

有法为此在 SDWebImage: SDWebImage / SDWebImage / UIButton+WebCache.h

导入此文件在您的类:

#import <SDWebImage/UIButton+WebCache.h>

使用此方法的任何一种:

 - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state;
 - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder;
 - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options;
 - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletedBlock)completedBlock;
 - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock;
 - (void)setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock;