我正在尝试使用HJCache库运行我的应用程序,以便通过网络异步下载图像,但是在将委托和dataSource链接到TableView后,我遇到了这个问题。
- [UIView tableView:numberOfRowsInSection:]:无法识别的选择器发送到实例0x7190210 2012-11-29 00:36:41.059 HJCacheTest1 [2080:c07] * 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [UIView tableView: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];
}
谢谢你们。
答案 0 :(得分:1)
问题在于接口构建器连接错误。
可能的问题:您已将xib的视图插座连接到UITableView。
可能的解决方案:重新连接所有xib连接。