故事板中 TableView 的自定义初始化

Custom init for TableView from storyboard

试图在 google 和 Whosebug 上搜索答案,但卡住了。 我正在使用 https://parse.com/docs/ios/api/Classes/PFQueryTableViewController.html 用我的对象填充数据。 Everything seems nice I got correct data for this table view

但我想使用我的故事板单元格,但这似乎是我错误的初始化。

    - (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;

}

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

我不知道有关此特定 Parse 视图控制器的任何详细信息,但如果您将单元格定义为故事板中的原型单元格,则无需在代码中注册任何内容。只需确保在故事板中为该单元格指定重用标识符并在 cellForRowAtIndexPath.

中使用相同的重用标识符即可

我解决了它,首先我修复了视图控制器的初始化,我从情节提要中调用了评论 Vic,然后在情节提要中重新创建了我的控制器,之后我实现了自定义 pfquery 单元格