Tried to search answer on google and stackoverflow but stuck. I am using https://parse.com/docs/ios/api/Classes/PFQueryTableViewController.html to fill up data with my objects. Everything seems nice I got correct data for this table view
But I want to use my storyboard cell, but this seems I made wrong init.
- (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;
}
And here is code for 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;
}
Please help me to achieve how to display my cell
I don't know any details about this particular Parse view controller, but if you define your cell as a prototype cell in your storyboard, you don't need to register anything in code. Just make sure you specify a reuse identifier for that cell in the storyboard and use the same reuse identifier inside cellForRowAtIndexPath
.
我解决了这个问题,首先固定了视图控制器的init,然后从情节提要中调用了Comment Vic,然后在实现自定义pfquery单元后在情节提要中重新创建了控制器
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.