我正在尝试使用HJCache库运行我的应用程序,以便通过网络异步下载图像,但是在我将委托和dataSource链接到TableView之后,我就会遇到这个问题。
-UIView tableView:-UIView::未识别的选择器发送到实例0x7190210 2012-11-29 00:36:41.059 HJCacheTest12080:C 07*由于不明异常“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];
}从现在开始谢谢你。
发布于 2012-11-29 11:03:51
问题在于接口构建器连接错误。
可能出现的问题:您将xib的视图出口连接到UITableView。
可能的解决方案:重新连接所有xib连接。
https://stackoverflow.com/questions/13615776
复制相似问题