I use SDWebImage in my project but I was wondering if there is a way to set the image to the background of a button?
You just need to import this class of SDWebImage
#import "SDWebImage/UIButton+webCache.h"
and UIButton+webCache
this class is Category class so you can set your button background image like this,
[yourBTN sd_setBackgroundImageWithURL:[NSURL URLWithString:@"urlString.png"] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With