Commit Graph

3660 Commits

Author SHA1 Message Date
Fernando Saragoca 0dfb649faf Documented categories (appledoc) 2011-11-23 00:33:57 +01:00
Olivier Poitrey b3d7a5c450 Merge pull request #39 from 433/version_check_fix
update version check to make #if work for iOS >= 4
2011-10-25 04:00:34 -07:00
Ilya Samartsev 6cda5dcf4d update version check to make #if work for iOS >= 4 2011-10-25 11:02:50 +04:00
Olivier Poitrey 17450bdf1f Merge pull request #37 from neogithub/patch-1
Update README.md
2011-10-20 11:15:07 -07:00
neogithub 0b9b945a37 Update README.md 2011-10-20 10:03:19 -03:00
Olivier Poitrey 23ae1cb00c Add SDWebImagePrefetcher, an utility class to preventively warm-up SDWebImage cache (fix #32)
Contributed by https://github.com/mystcolor
2011-10-04 16:07:36 +02:00
Olivier Poitrey 9e2d414c28 Fix wrong options values 2011-10-04 16:05:32 +02:00
Olivier Poitrey 92d7a01a52 Perform image decoding/optimization in the IO thread instead of main thread for better responsiveness (fix #18)
This new optimization is currently disabled by default so you can test it and give us feedback.
To enable it, add #define ENABLE_SDWEBIMAGE_DECODER and to not forget to add SDWebImageDecoder class
to your projet.

Thanks to Adam Jernst (https://github.com/adamjernst) and James Tang (https://github.com/mystcolor)
for this great optimization. See https://github.com/rs/SDWebImage/pull/18 for more info.
2011-10-04 13:07:26 +02:00
Olivier Poitrey 4792909c5b Merge pull request #29 from nonamelive/patch-1
Fixed a potential crash when the delegate retainCount = 1, which means th
2011-10-03 07:18:06 -07:00
Olivier Poitrey 7d0e544c50 Add an option to disable on disk caching (fix #16) + refactor other options (low prio and retry failed) to an options: parameter 2011-10-03 15:54:49 +02:00
Olivier Poitrey 7c06b3a314 Failsafe a very common usage error (passing URL as NSString instead of NSURL) 2011-10-01 00:38:44 +02:00
nonamelive 2b0bb248f4 Fixed a potential crash when the delegate retainCount = 1, which means the delegate is only retained by the SDWebImageManager and the delegate's dealloc method has a structure like the code below.
- (void)dealloc
{
    [manager cancelForDelegate:self];
    [super dealloc];
}
2011-09-28 14:29:51 +08:00
Olivier Poitrey e9d43e443a When storeImage:imageData:forKey:toDisk: is called with toDisk:YES but no data, do not prevent memory caching (fix: #24) 2011-09-21 15:03:14 +02:00
Olivier Poitrey 1a355d09c2 Merge pull request #20 from exalted/master
Added UIButton+WebCache category
2011-07-25 11:12:18 -07:00
Ali Servet Donmez 4b00568942 Added UIButton+WebCache category 2011-07-25 17:50:21 +02:00
Adam Ernst 45cc126d32 Fix race condition with SDWebImageManager's cancelForDelegate:
The -cancelForDelegate: method was working for downloads but not local cache checks. Add some new machinery to keep track of pending cache requests and only message the delegate if it hasn't since requested cancellation.
2011-07-13 23:03:36 +02:00
Olivier Poitrey 47aad5b55f Fix some implicit conversion warnings 2011-07-13 21:55:34 +02:00
Olivier Poitrey 4005884df5 Fix coding style 2011-07-13 21:23:13 +02:00
siuying 314837de7e Fix a leak on Mac OSX 2011-07-13 20:47:54 +02:00
Olivier Poitrey 0a2e9a3040 Merge pull request #12 from apptitude/master
Low priority download mode
2011-05-07 04:11:44 -07:00
Jeppe Vesterbæk 34e8082cde Add low priority download mode. Low priorities run NSUrlConnection in NSEventTrackingRunLoopMode 2011-05-06 10:30:50 +02:00
Olivier Poitrey 44fd72843b Clean delegates even on failed downloads 2011-03-21 16:40:09 +01:00
Jamie Pinkham 3116810b18 Added Mac OS X compatibility 2011-03-18 00:17:59 +01:00
Elio Gonzalez ee153fee04 Force retry of failed downloads 2011-01-25 03:37:04 +01:00
Olivier Poitrey 20b8cdf69d Remove wrong UIKit import and fix wrong indentation (space instead of tab) 2011-01-25 03:29:57 +01:00
Olivier Poitrey 1fe20c25d6 Remove the need for storeDataQueue dictionnary which required synchronization 2010-10-10 01:13:44 +02:00
niblh 9f492ccdf8 Add userInfo on SDWebImageDownloader.m 2010-10-07 12:15:16 +02:00
Olivier Poitrey 3f2f360ee2 Add support for system network activity indicator show/hide via notification
As showing/hiding the network activity indicator could conflict with your own code (i.e. the lib may hide the indicator when your code would still do some network stuff), the show/hide of the indicator isn't performed by the lib directly but SDWebImageDownloadStartNotification and SDWebImageDownloadStopNotification notifications are posted instead.

This lets you handle the indicator visiblity by yourself. If you're lazy, you can use the SDNetworkActivityIndicator library (http://github.com/rs/SDNetworkActivityIndicator) to handle it automatically. Once added to your project, all you have to do is to import this lib in addition to the SDWebImage lib.

Note that you should then use SDNetworkActivityIndicator for all your network status indicator visibility changes in your code if you don't want conflicts to happen.
2010-10-03 10:16:26 +02:00
Olivier Poitrey 2b352c3c3a Perform disk cache out operations asynchronousely in order to prevent from blocking the main runloop when a lot of cache queries are performed at the same time 2010-09-16 22:56:11 +02:00
Olivier Poitrey dffff12607 If nil is given as URL to setImageWithURL:, set the image to the placeholder image (or nil if no placeholder)
This is the recommanded way clear an image for reuse (as a UITableViewCell for instance). Calling setImageWithURL:
with nil URL will have the effect to cancel an eventual currently in progress download of a thumbnail for this UIImageView.
Affecting the image property directly won't have this effect and may lead to image being re-affected once download is completed.
2010-09-16 13:02:33 +02:00
Olivier Poitrey d2dc4cbbac Do not convert images to JPEG when stored to disk for caching
This saves CPU and memory in all cases and alpha channel / image clearness if orignal format was PNG or GIF.
2010-08-29 03:22:20 +02:00
Olivier Poitrey 7f7dfbecd6 Ensure the downloader is started from the main thread 2010-06-21 01:30:12 +02:00
Olivier Poitrey 65549dec10 Better nil url handling 2010-06-12 16:37:47 +02:00
Olivier Poitrey 7350e1fa03 Fix english in new method naming 2010-06-11 16:32:35 +02:00
Olivier Poitrey 1b0cf3a3fb Add a compile time condition in order to compile with Base SDK pre iOS4 2010-06-11 15:14:42 +02:00
Olivier Poitrey d128c27cad Add `cancelCurrentImageLoading` method to UIImageView+WebCache 2010-06-11 15:06:04 +02:00
Olivier Poitrey 8cc6acb502 Fix typos in the README file (thanks Laurent Etiemble) 2010-06-11 14:40:44 +02:00
Olivier Poitrey 1cae0c4021 Set image to nil when trying to load nil URL 2010-06-11 06:17:54 +02:00
Olivier Poitrey e0e369659e Replace the NSOperation based downloader by a simple async NSURLConnection (read-on to understand why)
I finally found the reason behind the download not started while UITableView is manipulated: the default NSURLConnection runloop mode. Its default mode is NSEventTrackingRunLoopMode which is interrupted by UI events. Changing default NSURLConnection runloop mode to NSRunLoopCommonModes just fix this good old responsiveness issue.

I thus decided to replace the current NSOperation based implementation by this finding, as NSOperation is far more expensive than simple async connections. Additionally, moving aways from NSOperation here fix an odd lagging issue with iOS 4, an issue I can't explain at the moment.

Note that `SDWebImageDownloader`'s `setMaxConcurrentDownloads:` method is now a no-op as I didn't implemented the NSOperation queuing system with async connections. I don't think it still necessary as thread-less async connectaions are very lightweight. If you think there is a real need of this, I may reconsider and implement it in the future. In the meantime, this method does nothing and its usage is declared as deprecated.
2010-06-09 04:36:18 +02:00
Olivier Poitrey 467be16671 Fix some iOS 4.0 deprecated method use 2010-06-08 14:44:03 +02:00
Olivier Poitrey 4fedcee49e Add multitasking support by cleaning the memory when app is sent to background 2010-06-08 14:38:55 +02:00
Olivier Poitrey 58a24963b5 Set references to nil after release in dealloc methods 2010-06-02 01:37:39 +02:00
Henrik N 1753b2d844 Fix potential crasher in SDImageCache. Don't rely on memory cache to retain a returned value. 2010-03-20 20:13:27 +01:00
Olivier Poitrey 439c01527f Ensure URL caching is disabled in order to prevent from duplicate caching 2010-03-17 17:43:12 +01:00
Olivier Poitrey a230f6aba8 Handle nil image urls nicely 2009-12-31 14:12:50 +01:00
Olivier Poitrey 0bdd448ca8 Fix some warnings when most warnings are activated 2009-11-11 15:43:11 +01:00
Olivier Poitrey 79c5fa177d Fix the name of the SDWebImageManagerDelegate protocol 2009-09-28 23:56:24 +02:00
Olivier Poitrey 2fa0626aaa Remove the dirty hack of storing the helper into the first subview of the UIImageView and prevent duplicate downloads of the same URL
The helper (now called manager) is now handling the mapping between the UIImageView and its downloader.
This way we don't polute the UIImageView, and don't remove its capability to have subviews.
This change removes the automatic handling of image placeholder. The placeholder image can
be passed as second argument of setImageWithURL:placeholderImage:
The manager now handle duplicate downloads for the same URL gracefuly by sharing the same downloader
for all requestors.
Finaly, the manager handles URLs which can't create an image (HTTP error or invalid format) by flagging
them so it won't retry to download them again and again.
2009-09-24 02:35:14 +02:00
Olivier Poitrey 972c304957 Replace the SDWebImageView by an UIImageView category make the integration even simpler 2009-09-23 03:23:08 +02:00
Olivier Poitrey b2a3d31557 Use user cache directory instead of ducment directory to prevent from cache to be synced back and forth in iTunes 2009-09-22 17:13:56 +02:00