Я хочу ограничить размер кэша памяти и дискового кэша для SDImageCache.
Ниже приведен код, который я использовал для загрузки изображений. По умолчанию изображения сохраняются в кеше и присутствуют в папке «Библиотека» песочницы.
моё приложение
ID/Library/Caches/com.hackemist.SDWebImageCache.default/
#import
...
- (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;
}
Подробнее здесь: https://stackoverflow.com/questions/369 ... imagecache