У меня есть UITableViewController в моем приложении. В этой таблице я выполнить эту Синтаксическая запрос:Как фильтровать запрос Parse по индексу таблицы?
-(IBAction)joinEvent:(id)sender {
PFQuery *query = [PFQuery queryWithClassName:@"Event"];
[query selectKeys:@[@"Vacants"]];
[query whereKey:@"Username" equalTo:PFUser.currentUser.username];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
// The find succeeded.
NSLog(@"Successfully retrieved %lu scores.", (unsigned long)objects.count);
// Do something with the found objects
for (NSObject *object in objects){
NSString *a = [object valueForKey:@"Vacants"];
NSLog(@"vacants %@", a);
}
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
[self.tableView reloadData];
}];
}
Этот запрос получает мне все vacants в моем облаке синтаксического анализа.
Я хочу, чтобы иметь возможность просто получить вакансии за определенный индекс IndexPath.row моего стола.
До сих пор я пытался использовать
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
вместо IBAction, но все тот же результат. Но, используя этот подход, я не знаю, как вызвать didSelectRowAtIndexPath из IBAction, и я считаю, что это решит мою проблему.
Это мой метод cellForRowAtIndexPath:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellID = @"cell";
TFGResultsTableViewCell *cell= [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
if(cell == nil) {
cell = [[TFGResultsTableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:cellID];
}
// Configure the cell...
cell.eventnamelabel.text = [eventnameArray objectAtIndex: [indexPath row]];
cell.userLabel.text = [userArray objectAtIndex: [indexPath row]];
cell.sportLabel.text = [sportArray objectAtIndex: [indexPath row]];
cell.eventDateLabel.text = [dateArray objectAtIndex: [indexPath row]];
cell.eventHourLabel.text = [hourArray objectAtIndex: [indexPath row]];
cell.eventPlaceLabel.text = [placeArray objectAtIndex: [indexPath row]];
cell.vacantsLabel.text = [vacantsArray objectAtIndex: [indexPath row]];
cell.cityLabel.text = [cityArray objectAtIndex: [indexPath row]];
if([cell.sportLabel.text isEqualToString:@"Soccer" ]){
cell.eventImage.image = [UIImage imageNamed:@"SoccerBallIcon.png"];
}
else{
cell.eventImage.image = [UIImage imageNamed:@"icon.png"];
}
return cell;
}
Что в вашем представлении таблицы? Только индекс ничего не делает ... – Wain
Вы хотите запросить определенные индексированные данные из облака синтаксического анализа? – rajram
My tableviewcontroller был создан с использованием раскадровки, поэтому, чтобы ссылаться на мое табличное представление, я просто делаю [self.tableview XXX]; –