ios – setBackgroundimage在UIButton使用SDWebimage

ios – setBackgroundimage在UIButton使用SDWebimage,第1张

概述我想使用SDWeb Image设置UIButton背景图像. 代码: – [btn.imageView setImageWithURL:[NSURL URLWithString:@"image url here"] placeholderImage:[UIImage imageNamed:@"placeholder"]]; 谢谢 SDWebIm 我想使用SDWeb Image设置UIbutton背景图像.

代码: –

[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所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1111375.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存