ios – 将图像从SDWebImage设置为按钮背景
发布时间:2020-12-14 17:13:45 所属栏目:百科 来源:网络整理
导读:我在我的项目中使用SDWeb Image,但我想知道是否有办法将图像设置为按钮的背景? 解决方法 SDWebImageManager *manager = [SDWebImageManager sharedManager];[manager downloadImageWithURL:imageURL options:0 progress:^(NSInteger receivedSize,NSInteger
我在我的项目中使用SDWeb
Image,但我想知道是否有办法将图像设置为按钮的背景?
解决方法SDWebImageManager *manager = [SDWebImageManager sharedManager]; [manager downloadImageWithURL:imageURL options:0 progress:^(NSInteger receivedSize,NSInteger expectedSize) { // progression tracking code } completed:^(UIImage *image,NSError *error,SDImageCacheType cacheType,BOOL finished,NSURL *imageURL) { if (image) { // do something with image [button setBackgroundImage:image forState:UIControlStateNormal]; } }]; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |