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