Parse platform PFQueryTableViewController在使用故事板时不显示图像
我已经做了很多研究来找出为什么会发生这种情况,并且尝试了很多事情都没有成功。 我正在使用PFQueryTableViewController从parse.com提取数据。我用的是故事板。我没有使用自定义的表视图单元格,只是使用常规的PFTableViewCell 从解析中提取数据,单元格中的文本按预期显示,但不显示图像。甚至占位符图像也不会显示。调试时,我可以观察到PFTableViewCell的_remoteImageView属性为nil。我认为这是因为故事板中的原型单元没有图像视图。但是原型单元绑定到定制类中的PFTableViewCell 我尝试过的事情: 通过initWithCoder而不是initWithStyle初始化从PFQueryTableViewController派生的自定义TableViewController。不起作用。 将cell.imageView文件设置为带有cellForRowAtIndexPath中图像的PFFile后,调用[cell.imageView loadInBackground]。不起作用。 如果我不使用dequeueReusableCellWithIdentifier:cellIdentifier并直接使用initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier实例化单元格,则会显示图像!!但是segue不起作用,它不会进入细节视图 请帮忙! 见下面的代码:Parse platform PFQueryTableViewController在使用故事板时不显示图像,parse-platform,Parse Platform,我已经做了很多研究来找出为什么会发生这种情况,并且尝试了很多事情都没有成功。 我正在使用PFQueryTableViewController从parse.com提取数据。我用的是故事板。我没有使用自定义的表视图单元格,只是使用常规的PFTableViewCell 从解析中提取数据,单元格中的文本按预期显示,但不显示图像。甚至占位符图像也不会显示。调试时,我可以观察到PFTableViewCell的_remoteImageView属性为nil。我认为这是因为故事板中的原型单元没有图像视图。但是原型
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
// The className to query on
self.parseClassName = @"RestaurantType";
// The key of the PFObject to display in the label of the default cell style
self.textKey = @"text";
// Uncomment the following line to specify the key of a PFFile on the PFObject to display in the imageView of the default cell style
self.imageKey = @"image";
// Whether the built-in pull-to-refresh is enabled
self.pullToRefreshEnabled = YES;
// Whether the built-in pagination is enabled
self.paginationEnabled = YES;
// The number of objects to show per page
self.objectsPerPage = 25;
}
return self;
}
- (PFQuery *)queryForTable
{
PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];
if (self.objects.count == 0)
query.cachePolicy = kPFCachePolicyCacheThenNetwork;
[query orderByAscending:@"type"];
return query;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object
{
static NSString *cellIdentifier = @"TypeCell";
PFTableViewCell* cell = (PFTableViewCell*)[self.tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell)
cell = [[PFTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.textLabel.text = object[@"type"];
PFFile *thumbnail = object[@"image"];
cell.imageView.image = [UIImage imageNamed:@"AppIcon58x58.png"];
cell.imageView.file = thumbnail;
return cell;
}