我有三个观点。第一个视图在PFUsers
中显示PFQueryTableViewController
,其中包含对象client
。用户可以按下PFUser
,然后它将显示详细视图,其中包含client
对象上的大量信息。我有一个按钮Points
,我试图显示客户在那个季节所做的点,这是它自己的对象points
。我想在PFQueryTableViewController
中展示这一切。所以我坚持在最后PFUsers
显示Point
PFQueryTableViewController
对象。这是它在故事板中的样子(我知道它可能听起来有点令人困惑所以我添加了图像)
以下是我检索client object
:
- (id)initWithCoder:(NSCoder *)aCoder {
self = [super initWithCoder:aCoder];
if (self) {
// Custom the table
// The className to query on
self.parseClassName = @"client";
// The key of the PFObject to display in the label of the default cell style
self.textKey = @"name";
//self.imageKey = @"imageFile";
// Whether the built-in pull-to-refresh is enabled
self.pullToRefreshEnabled = NO;
// Whether the built-in pagination is enabled
self.paginationEnabled = NO;
// The number of objects to show per page
self.objectsPerPage = 50;
}
return self;
}
选择Detail View
:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// "showDetail" is the default segue identifier in a new Master-Detail Project for Table Cell -> Detail View
if ([[segue identifier] isEqualToString:@"show"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
// Pass the PFObject at this row to the detail view
PFObject *object = [self objectAtIndexPath:indexPath];
[[segue destinationViewController] setDetailItem:object];
}
}
尝试在最终视图中显示PFUser/Clients
Points
对象:
- (PFQuery *)queryForTable {
PFQuery *query = [PFQuery queryWithClassName:@"player"];
// The key of the PFObject to display in the label of the default cell style
self.textKey = @"opponent";
// 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 = 50;
[query includeKey:@"user"];
PFUser *user = [self.detailItem objectForKey:@"user"];
[query whereKey:user.username equalTo:@"username"]; //where you set the username to the specific user to get only this user's post.
// If no objects are loaded in memory, we look to the cache first to fill the table
// and then subsequently do a query against the network.
if (self.objects.count == 0) {
query.cachePolicy = kPFCachePolicyCacheThenNetwork;
}
[query orderByDescending:@"createdAt"];
return query;
}
思想:
我想我可能需要从PFUser.Username
对象获取Client
id然后将其发送到Points View
以显示该特定用户的Points
对象PFQueryTableViewController
。如果是这样,我该怎么办?
目标:
要显示Clients Object
中PointsController
的PFUser,以便我可以显示PFUser的Points
对象!