ネット経由で画像を非同期にダウンロードするために HJCache ライブラリを使用してアプリを実行しようとしていますが、デリゲートと dataSource を TableView にリンクすると、この問題が発生します。
-[UIView tableView:numberOfRowsInSection:]: 認識されないセレクターがインスタンス 0x7190210 2012-11-29 00:36:41.059 HJCacheTest1[2080:c07] に送信されましたnumberOfRowsInSection:]: インスタンス 0x7190210 に送信された認識されないセレクター
私の問題はどこにあるのでしょうか?
まず、HJCache クラスと ImageCell.h .m および .xib を追加しました。次に、クラスを ViewController.m にインポートし、このコードを配置しました。
- (void)viewDidLoad
{
[super viewDidLoad];
self.imgMan = [[HJObjManager alloc] init];
NSString* cacheDirectory = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/imgcache/imgtable/Luai/"] ;
HJMOFileCache* fileCache = [[HJMOFileCache alloc] initWithRootPath:cacheDirectory];
self.imgMan.fileCache = fileCache;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* cellIdentifier = @"ImgCell";
ImgCell *cell = (ImgCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:cellIdentifier owner:nil options:nil];
cell = (ImgCell*)[nib objectAtIndex:0];
}
///// Image reloading from HJCacheClasses
[cell.img clear];
NSString *str1 = [imageArray objectAtIndex:indexPath.row];
NSString *trimmedString = [str1 stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSURL *url = [NSURL URLWithString:trimmedString];
cell.img.url = url; //set the url to img view
[self.imgMan manage:cell.img];
}
今からありがとう。