sdwebimage

iOS CocoaPods安装与使用

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-08 22:43:49
1.MAC安装Ruby环境 1> 安装RVM 控制台命令: $curl –L https://get.rvm.io | bash –s stable $source ~/.rvm/scripts/rvm $rvm –v (查看版本,检查是否安装正确) 2> 用rvm安装ruby环境 $rvm install 2.0.0 (期间需要按enter键输入管理员密码等) 内容很长,我这只截取前面一部分 $rvm 2.0.0 --detault (将上面用rvm install安装的那个版本设为系统默认版本) $ruby –v (查看ruby版本,检查是否安装正确) 2.安装CocoaPods 1> 通过淘宝的镜像来访问cocoapods 天朝,由于cocoapods.org被墙,我们可以使用淘宝的ruby镜像来访问 $gem sources --remove https://rubygems.org/ $gem sources –a http://ruby.taobao.org/ $gem sources –l (用该命令查看ruby镜像是否是taobao) 2> 安装CocoaPods $sudo gem install cocoapods (需要输入管理员密码) 3> 验证cocoapods是否安装成功 $pod 3.cocoapods的简单使用 1>

IOS load images from URL using SDWebImage

拟墨画扇 提交于 2020-01-07 02:19:07
问题 I'm trying to load images from a json URL with the following but I get an error on [cell.imageView setImageWithURL:[NSURL URLWithString:@"coffeemugDirectLink"] placeholderImage:[UIImage imageNamed:@"heart.png"]]; the errors are Expected ',' separator and Expected expression in container literal What am I doing wrong? How can I load the URLs from json into my cell in UICollectionView? import UIKit import SDWebImage class TopratedVC: BaseViewController { @IBOutlet var collectionview:

Send path of SDWebImage stored image to a UIWebView

一笑奈何 提交于 2020-01-05 12:07:20
问题 I need to be able to get a path to images that cached. While I am wondering if there is a way to do this using SDWebImage, I could probably get away with just having the knowledge to return a path to an image stored in the cache so I can display it within a uiwebview inside an image tag. 回答1: According to this https://github.com/rs/SDWebImage/issues/25 it would seem you can simply refer to the image by it's original url and it will be correctly picked up from cache. 来源: https://stackoverflow

SDWebImage operations not being canceled

て烟熏妆下的殇ゞ 提交于 2020-01-02 16:57:19
问题 I have a table view that includes several feed cells that each have a few images a piece. I'm loading in the images like this: [timeLineCell.avatar setImageWithURL:[NSURL URLWithString:[feedAccount accountAvatarUrl]] placeholderImage:avatarPlaceholderImage options:SDWebImageRetryFailed]; This works fine, but on slow connections the operations tend to just climb instead of removing old operations for the same images. That is -- if I scroll down and back up through the same cells, it adds the

Strange UITableViewCellStyleSubtitle + [cell imageView] behaviors

狂风中的少年 提交于 2020-01-02 11:23:47
问题 This question's been bugging me for a month and i've been resisting posting about it, but I can hold out no longer. Here's what's going on: I have an app with UITableViewCell s, all initialized as UITableViewCellStyleDefault . For each one, I am setting the image view's image using the excellent SDWebImage package, which extends UIImageView to have a method for [UIImageView setImageWithURL:(NSURL*)url placeholderImage:(UIImage*)image]. The problem is that the images are showing up more narrow

Strange UITableViewCellStyleSubtitle + [cell imageView] behaviors

拈花ヽ惹草 提交于 2020-01-02 11:20:14
问题 This question's been bugging me for a month and i've been resisting posting about it, but I can hold out no longer. Here's what's going on: I have an app with UITableViewCell s, all initialized as UITableViewCellStyleDefault . For each one, I am setting the image view's image using the excellent SDWebImage package, which extends UIImageView to have a method for [UIImageView setImageWithURL:(NSURL*)url placeholderImage:(UIImage*)image]. The problem is that the images are showing up more narrow

SDWebImage + UITableViewCell, wrong image when scrolling?

蹲街弑〆低调 提交于 2019-12-31 22:23:08
问题 i'm having an issue using SDWebImage to load images to a UIImageView inside a custom UITableViewCell. This is my code at the UITableView delegate: static NSString *userTableId = @"userTableId"; UserDetailsTableViewCell *cell = (UserDetailsTableViewCell *)[tableView dequeueReusableCellWithIdentifier:userTableId]; NSDictionary *user = [userList objectAtIndex:indexPath.row]; NSInteger position = indexPath.row + 1; [cell.userDetailsView loadFromDictionary:user WithIndex:position ForCharitie:false

SDWebImage + UITableViewCell, wrong image when scrolling?

百般思念 提交于 2019-12-31 22:21:52
问题 i'm having an issue using SDWebImage to load images to a UIImageView inside a custom UITableViewCell. This is my code at the UITableView delegate: static NSString *userTableId = @"userTableId"; UserDetailsTableViewCell *cell = (UserDetailsTableViewCell *)[tableView dequeueReusableCellWithIdentifier:userTableId]; NSDictionary *user = [userList objectAtIndex:indexPath.row]; NSInteger position = indexPath.row + 1; [cell.userDetailsView loadFromDictionary:user WithIndex:position ForCharitie:false

Ambiguous use of 'sd_setImage(with:placeholderImage:completed:)' with Swift 3

只谈情不闲聊 提交于 2019-12-30 01:45:14
问题 I am making the following call using SDWebImage on my imageView , which works fine with Swift 2 but gives an error with XCode 8 beta 5 compiling with Swift 3 : imageView.sd_setImage(with:url, placeholderImage:placeholder, completed: { (image: UIImage?, error: Error?, cacheType: SDImageCacheType, imageURL: URL?) in ... }); The error is: Ambiguous use of 'sd_setImage(with:placeholderImage:completed:)' I suspect I have something wrong in the signature for the completed handler, but I can't

How to update image in cache when image changed on server with SDWebImage

强颜欢笑 提交于 2019-12-29 05:52:20
问题 I am using SDWebImage library to download images from server. https://github.com/rs/SDWebImage SDWebImage not able update the cached image when image updated on server with the same url. 回答1: SDWebImage does some caching by default, so it would be better to use a new URL if the image changes. So, for instance, if you have control over the URL and can change it every time the image has changed, you could do that. If that's not the case, try using SDWebImageRefreshCached in the options field in