gpt4 book ai didi

ios - 将 SDWebImage 中的图像设置为按钮的背景

转载 作者:可可西里 更新时间:2023-11-01 06:24:09 28 4
gpt4 key购买 nike

我在我的项目中使用了 SDWebImage,但我想知道是否有办法将图像设置为按钮的背景?

最佳答案

你只需要导入这个类的SDWebImage

#import "SDWebImage/UIButton+webCache.h"

UIButton+webCache这个类是Category类所以你可以这样设置你的按钮背景图片,

[yourBTN sd_setBackgroundImageWithURL:[NSURL URLWithString:@"urlString.png"] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

关于ios - 将 SDWebImage 中的图像设置为按钮的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36277472/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com