我想限制SDImageCache的內存緩存和磁盤緩存的大小。 以下是我用於下載圖像的代碼。默認情況下,它將圖像保存在緩存中,並存在於沙盒的Library文件夾中。如何限制SDImageCache的磁盤和內存緩存的大小
我的應用 ID /圖書館/緩存/ com.hackemist.SDWebImageCache.default/
#import <SDWebImage/UIImageView+WebCache.h>
...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:MyIdentifier] autorelease];
}
// Here we use the new provided sd_setImageWithURL: method to load the web image
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
cell.textLabel.text = @"My Text";
return cell;
}
是否有任何其他的方法? – Burak