I am trying to run my app with HJCache library for asynchronous download of images over the net, but I am getting this issue after I link the delegate and dataSource to the TableView.
-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7190210 2012-11-29 00:36:41.059 HJCacheTest1[2080:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7190210'
Where could be my problem?
Firstly, I have add the HJCache Classes and ImageCell.h .m and .xib. Secondly, I have imported the classes to my ViewController.m and put this codes;
- (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];
}
Thanks from now.