首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >HJCache库UITableView问题

HJCache库UITableView问题
EN

Stack Overflow用户
提问于 2012-11-28 22:44:09
回答 1查看 160关注 0票数 1

我正在尝试使用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中,并将这些代码放入;

代码语言:javascript
复制
- (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];
}

从现在开始谢谢你。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-29 11:03:51

问题在于接口构建器连接错误。

可能出现的问题:您将xib的视图出口连接到UITableView。

可能的解决方案:重新连接所有xib连接。

  1. 将视图出口连接到xib中的UIView
  2. 将tableView接口连接到xib中的UItableView
  3. 连接tableView数据源并委托到文件所有者
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13615776

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档