代码: –
[btn.imageVIEw setimageWithURL:[NSURL URLWithString:@"image url here"] placeholderImage:[UIImage imagenamed:@"placeholder"]];
谢谢
解决方法 SDWebImage中有这样的方法: SDWebImage / SDWebImage / UIButton+WebCache.h在你的班上导入这个文件:
#import <SDWebImage/UIbutton+Webcache.h>
使用以下任一方法:
- (voID)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state;- (voID)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder;- (voID)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options;- (voID)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state completed:(SDWebImageCompletionBlock)completedBlock;- (voID)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock;- (voID)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock;总结
以上是内存溢出为你收集整理的ios – setBackgroundimage在UIButton使用SDWebimage全部内容,希望文章能够帮你解决ios – setBackgroundimage在UIButton使用SDWebimage所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)