| 1 |
- {"Name":"SDWebImage","Id":2105,"Alias":"sdwebimage","Description":"Adds methods to `UIImageView` supporting asynchronous web image loading:\n\n```csharp\nusing SDWebImage;\n...\n\nconst string CellIdentifier = \"Cell\";\n\npublic override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)\n{\n\tUITableViewCell cell = tableView.DequeueReusableCell (CellIdentifier) ??\n\t\tnew UITableViewCell (UITableViewCellStyle.Default, CellIdentifier);\n\t\n\t// Use the SetImage extension method to load the web image:\n\tcell.ImageView.SetImage (\n\t\turl: new NSUrl (\"http://db.tt/ayAqtbFy\"), \n\t\tplaceholder: UIImage.FromBundle (\"placeholder.png\")\n\t);\n\n\treturn cell;\n}\n```\n\nIt provides:\n\n* `UIImageView` and `UIButton` extension methods adding web image loading and cache management.\n* An asynchronous image downloader\n* An asynchronous memory + disk image caching with automatic cache expiration handling\n* Animated GIF support\n* WebP format support\n* A background image decompression\n* A guarantee that the same URL won\u0027t be downloaded several times\n* A guarantee that bogus URLs won\u0027t be retried again and again\n* A guarantee that main thread will never be blocked\n* Performances!\n* Use GCD and ARC\n* Arm64 support\n\n","Version":"3.7.3.1","Summary":"Extensions for UIImageView allowing you to asynchronously load web images.","QuickStart":"Adds methods to `UIImageView` supporting asynchronous web image loading:\n\n```csharp\nusing SDWebImage;\n...\n\nconst string CellIdentifier = \"Cell\";\n\npublic override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)\n{\n\tUITableViewCell cell = tableView.DequeueReusableCell (CellIdentifier) ??\n\t\tnew UITableViewCell (UITableViewCellStyle.Default, CellIdentifier);\n\t\n\t// Use the SetImage extension method to load the web image:\n\tcell.ImageView.SetImage (\n\t\turl: new NSUrl (\"http://db.tt/ayAqtbFy\"), \n\t\tplaceholder: UIImage.FromBundle (\"placeholder.png\")\n\t);\n\n\treturn cell;\n}\n```\n\nIt provides:\n\n* `UIImageView` and `UIButton` extension methods adding web image loading and cache management.\n* An asynchronous image downloader\n* An asynchronous memory + disk image caching with automatic cache expiration handling\n* Animated GIF support\n* WebP format support\n* A background image decompression\n* A guarantee that the same URL won\u0027t be downloaded several times\n* A guarantee that bogus URLs won\u0027t be retried again and again\n* A guarantee that main thread will never be blocked\n* Performances!\n* Use GCD and ARC\n* Arm64 support\n\n### Callbacks\n\nWith callbacks, you can be notified about the image download progress\nand whenever the image retrieval has completed:\n\n```csharp\ncell.ImageView.SetImage (\n\turl: new NSUrl (\"http://db.tt/ayAqtbFy\"), \n\tplaceholder: UIImage.FromBundle (\"placeholder.png\"),\n\tcompletedHandler: (image, error, cacheType) =\u003e {\n\t\t// Handle download completed...\n\t}\n);\n```\n\nCallbacks are not called if the request is canceled.\n\n## Using SDWebImageManager Independently\n\nThe SDWebImageManager is the class behind the UIImageView extension\nmethods. It owns the asynchronous downloader and the image cache. You\ncan reuse this class directly for cached web image downloading in other\ncontexts.\n\n```csharp\nSDWebImageManager.SharedManager.Download (\n\turl: new NSUrl (\"http://db.tt/ayAqtbFy\"), \n\toptions: SDWebImageOptions.CacheMemoryOnly,\n\tprogressHandler: (recievedSize, expectedSize) =\u003e {\n\t\t// Track progress...\n\t},\n\tcompletedHandler: (image, error, cacheType, finished) =\u003e {\n\t\tif (image != null) {\n\t\t\t// do something with the image\n\t\t}\n\t}\n);\n```\n\n## Using SDWebImageDownloader Independently\n\nIt\u0027s also possible to use the asynchronous image downloader independently:\n\n```csharp\nSDWebImageDownloader.SharedDownloader.DownloadImage (\n\turl: new NSUrl (\"http://db.tt/ayAqtbFy\"),\n\toptions: SDWebImageDownloaderOptions.LowPriority,\n\tprogressHandler: (receivedSize, expectedSize) =\u003e {\n\t\t// Track progress...\n\t},\n\tcompletedHandler: (image, error, finished) =\u003e {\n\t\tif (image != null \u0026\u0026 finished) {\n\t\t\t// do something with the image\n\t\t}\n\t}\n);\n```\n\n## Using SDImageCache Independently\n\nYou may also use the image cache independently. SDImageCache maintains a\nmemory cache and an optional disk cache. Disk writes are performed\nasynchronously as well.\n\nThe SDImageCache class provides a singleton instance for convenience but\nyou can create your own instance if you want to create Independent\ncaches.\n\n```csharp\nvar myCache = new SDImageCache (\"MyUniqueCacheKey\");\n\nmyCache.QueryDiskCache (\"UniqueImageKey\", image =\u003e {\n\t// If image is not null, image was found\n\tif (image != null) {\n\t\t// Do something with the image\n\t}\n });\n```\n\nBy default SDImageCache will lookup the disk cache if an image can\u0027t be\nfound in the memory cache. You can prevent this from happening by\ncalling the alternative method `ImageFromMemoryCache`.\n\nTo store an image into the cache, you use the `StoreImage` method:\n\n```csharp\nSDImageCache.SharedImageCache.StoreImage (image: myImage, key: \"myKey\");\n```\n\nBy default, the image will be stored in memory cache as well as on disk\ncache. If you want only the memory cache use:\n\n\n```csharp\nSDImageCache.SharedImageCache.StoreImage (image: myImage, key: \"myKey\", toDisk: false);\n```\n\n## Using cache key filter\n\nSometimes, you may not want to use image URLs as cache keys because part\nof the URL is unstable. SDWebImageManager provides a way to set a cache\nkey filter that maps NSUrls to cache key strings.\n\nThe following example sets a filter in the application delegate that\nremoves query parameters from the URL before querying the cache:\nkey:\n\n```csharp\nusing SDWebImage;\n...\n\npublic override bool FinishedLaunching (UIApplication app, NSDictionary options)\n{\n\tSDWebImageManager.SharedManager.SetCacheKeyFilter (url =\u003e {\n\t\tvar stableUrl = new NSUrl (scheme: url.Scheme, host: url.Host, path: url.Path); \n\t\treturn stableUrl.AbsoluteString;\n\t});\n\t...\n}\n```\n\n## Handle image refresh\n\n`SDWebImage` does very aggressive caching by default; it ignores any\ncaching control headers returned by the HTTP server, and caches images\nwith no time restrictions. This implies that your images change only if\ntheir URLs change.\n\nIf you don\u0027t control the image server, you may not be able\nto change the URL when an image changes--this is the case with\nFacebook profile URLs, for example. In this case, you may use the\n`SDWebImageOptions.RefreshCached` flag, which causes the cache to\nrespect HTTP caching control headers:\n\n```csharp\nvar imageView = new UIImageView ();\nimageView.SetImage (\n\turl: new NSUrl (\"http://db.tt/ayAqtbFy\"), \n\tplaceholder: UIImage.FromBundle (\"yourPlaceholder.png\"),\n\toptions: SDWebImageOptions.RefreshCached\n);\n```\n","Hash":"421bcd1ee575c44336cf1063913fb092","TargetPlatforms":["ios"],"TrialHash":null}
|