sdwebimage

Two Categories on the same Class with the same method name

二次信任 提交于 2019-12-03 03:07:49
I've noticed that the AFNetworking and SDWebImage categories on UIImageView have the same method name. AFNetworking: - (void)setImageWithURL:(NSURL *)url { [self setImageWithURL:url placeholderImage:nil]; } - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholderImage { NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPShouldHandleCookies:NO]; [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; } - (void)setImageWithURLRequest:

SDWebImage + UITableViewCell, wrong image when scrolling?

ⅰ亾dé卋堺 提交于 2019-12-03 03:06:17
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]; cell.userDetailsView.delegate = self; cell.userDetailsView.delegate = self; return cell; And here is

setBackgroundimage in UIButton using SDWebimage

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to set the UIButton background image using SDWebImage. Code :- [btn.imageView setImageWithURL:[NSURL URLWithString:@"image url here"] placeholderImage:[UIImage imageNamed:@"placeholder"]]; Thanks 回答1: There are method for this in SDWebImage : SDWebImage / SDWebImage / UIButton+WebCache.h Import this file in your class: #import <SDWebImage/UIButton+WebCache.h> Use any of this method: - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state; - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:

Show activity indicator in SDWebImage

对着背影说爱祢 提交于 2019-12-03 02:54:17
问题 I'm using SDWebView image and i want to show an Activity Indicator as placeholder, while fetching the image from remote. I tried Malek's answer here How to show an activity indicator in SDWebImage, but it seems that UIImage *cachedImage = [manager imageWithURL:url]; is deprecated. Is there anyone using this library that could tell me how can i insert an Activity Indicator while loading the image? EDIT Following the indications of Michael Frederick, i ended up with this code and everything's

SDWebImage Download image and store to cache for key

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hello I am using the SDWebImage framework in a project and I want to download and cache images, but I think my code is storing an image in the cache twice? Is there any way to store the image in the cache by a key only once? Here is my code. SDWebImageManager *manager = [SDWebImageManager sharedManager]; [manager downloadWithURL:[NSURL URLWithString:url] options:0 progress:^(NSUInteger receivedSize, long long expectedSize) { } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) { if(image){ NSString

iOS SDWebImage fade in new image

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been using SDWebImage on my iPhone app to handle all of the image loading. I am using a placeholder image, and I want to crossfade or fade in the new image once it loads. I am using a success block to set the image, and it is working great. No matter what I try, the image will not fade in though. I've tried sending the animation code back to the main thread, but that didn't help either. It just loads instantly... No animation. Here is my code. Any thoughts? // load placeholder image NSURL *url = ... _imageView = [[UIImageView alloc]

sdwebimage: UIImageView+WebCache.h: No such file or directory

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am fairly new to ios development - trying to use sdwebimage in my iphone project. I believe I completed all basic setups as required. But when I build, I get this error: No such file file or directory near this line: #import "UIImageView+WebCache.h" Yes I have added Target Dependencies I have added libSDWebImage.a in Link Binary With Libraries I have -all_load -ObjC in Other Linker Flags I also tried the -force_load ${BUILT_PRODUCTS_DIR}/libSDWebImage.a (64bit mac) My Use Header Search Paths is : $(BUILT_PRODUCTS_DIR) I cleaned the project

Handling download of image using SDWebImage while reusing UITableViewCell

微笑、不失礼 提交于 2019-12-02 19:49:26
I have used third party library SDWebImage to download image for my UITableView cells, UIImageView is created within cell and fired request while configuring cell like this. [imageView setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageNamed:@"default.jpg"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) { }]; Its working fine, however when I scroll fast, most of the images are not fully downloaded (I can see that in charles) because of that images are not cached. How do I cache the already sent request even though my cell got reused, so that

iOS SDWebImage fade in new image

て烟熏妆下的殇ゞ 提交于 2019-12-02 17:19:42
I've been using SDWebImage on my iPhone app to handle all of the image loading. I am using a placeholder image, and I want to crossfade or fade in the new image once it loads. I am using a success block to set the image, and it is working great. No matter what I try, the image will not fade in though. I've tried sending the animation code back to the main thread, but that didn't help either. It just loads instantly... No animation. Here is my code. Any thoughts? // load placeholder image NSURL *url = ... _imageView = [[UIImageView alloc] init]; [_imageView setImage:[UIImage imageNamed:@

Show activity indicator in SDWebImage

。_饼干妹妹 提交于 2019-12-02 16:45:43
I'm using SDWebView image and i want to show an Activity Indicator as placeholder, while fetching the image from remote. I tried Malek's answer here How to show an activity indicator in SDWebImage , but it seems that UIImage *cachedImage = [manager imageWithURL:url]; is deprecated. Is there anyone using this library that could tell me how can i insert an Activity Indicator while loading the image? EDIT Following the indications of Michael Frederick, i ended up with this code and everything's working fine. UIActivityIndicatorView *activityIndicator = [[[UIActivityIndicatorView alloc]