自情节提要的TableView的自定义初始化

伊戈尔·库兹涅佐夫(Igor Kuznetsov)

试图在谷歌和stackoverflow上搜索答案,但卡住了。我正在使用https://parse.com/docs/ios/api/Classes/PFQueryTableViewController.html使用对象填充数据。一切似乎都很不错,我对此表视图有正确的数据

但是我想使用情节提要单元,但这似乎是我的初始化错误。

    - (id)initWithPhoto:(PFObject *)aPhoto {
  // self = [super initWithStyle:UITableViewStylePlain];
    //self = [super init];
    self = [super initWithClassName:@"photo"];
    if (self) {
        // The className to query on
        self.parseClassName = kPAPActivityClassKey;

        // 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 comments to show per page
      //  self.obcojectsPerPage = 30;

        self.photo = aPhoto;

        self.likersQueryInProgress = NO;
    }
    return self;
}

这是cellForRowAtIndexPath的代码

- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
                        object:(PFObject *)object {
    [self.tableView registerClass:[KNPhotoDetailsCommentCell class] forCellReuseIdentifier:@"cell"];

    static NSString *cellIdent = @"cell";


         KNPhotoDetailsCommentCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdent];

        PFFile *userPhoto = userObject[@"profilePictureSmall"];
        [cell.userPhoto setFile:userPhoto];
        [cell.userPhoto loadInBackground];
    [cell.imageView setFile:userPhoto];
    [cell.imageView loadInBackground];
        [self configureBasicCell:cell atIndexPath:indexPath];
        NSString *userComment = object[@"content"];
        cell.userComment.text = userComment;
        cell.textLabel.text = userComment;
         return cell;

}

请帮助我实现如何显示我的单元格

伊戈尔·库兹涅佐夫(Igor Kuznetsov)

我解决了这个问题,首先我为视图控制器固定了init,我从情节提要中调用了Comment Vic,然后在实现自定义pfquery单元后在情节提要中重新创建了我的控制器

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章