【问题标题】:Retrieve Image for different Class Data browser Parse.com检索不同类数据浏览器 Parse.com 的图像
【发布时间】:2013-11-03 23:22:39
【问题描述】:

大家好,我正在尝试显示使用该应用注册的用户的个人资料图片。

在此查询中,我从照片数据浏览器中的不同类别获取数据。我尝试使用 MatchesQuery 但我找不到正确的组合...可能我的代码是错误的...

- (void)QueryForTableView {


    PFQuery *QueryForFriend=[PFQuery queryWithClassName:@"Amicizie"];
    [QueryForFriend whereKey:@"A_User" equalTo:[PFUser currentUser]];
    [QueryForFriend includeKey:@"Da_User"];

    PFQuery *RetrievePhoto_User = [PFUser query];
[RetrievePhoto_User whereKey:@"photo" matchesQuery:QueryForFriend];

    [QueryForFriend findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error) {
            NSLog(@"nome:%@", objects);
            self.UtentiInAttesa = objects ;
            [self.FFTableView reloadData];
        }
    }];


}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"CellaAmici";
    FFCustomCellFriendInAttesa  *cell = [self.FFTableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    if (!cell) {
        cell = [[FFCustomCellFriendInAttesa alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellaAmici"];
    }

    PFUser *FriendUser = [self.UtentiInAttesa objectAtIndex:indexPath.row];

    NSString *ValueNomeCognome = [[FriendUser objectForKey:@"Da_User"] valueForKey:FF_USER_NOMECOGNOME];
    cell.FFNomeFriendLabel.text = ValueNomeCognome;


    cell.FFFotoProfiloInAttesa.file = [FriendUser objectForKey:@"photo"];
    cell.FFFotoProfiloInAttesa.image = [UIImage imageNamed:@"FFNoFotoUSer"];

    [cell.FFFotoProfiloInAttesa.layer setMasksToBounds:YES];
    [cell.FFFotoProfiloInAttesa.layer setCornerRadius:22.5f];
    [cell.FFFotoProfiloInAttesa loadInBackground];

    return cell;
}

【问题讨论】:

  • PFQuery *queryFoto = [PFUser query];这个没有意义,应该是查询你的Photo类,我应该
  • 我不明白你是如何使用集合视图的......我使用了完全相同的代码......我不明白
  • 你应该为你的查询命名更有意义,否则我无法理解你的查询目的是什么。
  • 我发现了部分问题,在我发布答案之前,我需要您确认您是否将照片对象存储在Amicizie classUser class???
  • 在实践中,我需要的数据在“朋友”类中而不是照片在用于用户注册的特殊类_USER中。这很奇怪,因为我再说一遍,在 colactionView 中并没有给我这个东西带来问题

标签: uiimageview tableview parse-platform


【解决方案1】:

和你聊了一会儿。以下代码是不必要且错误的。如此简单地删除它,你就设置好了:

PFQuery *RetrievePhoto_User = [PFUser query];
[RetrievePhoto_User whereKey:@"photo" matchesQuery:QueryForFriend];

【讨论】:

    猜你喜欢
    • 2015-06-11
    • 1970-01-01
    • 2014-10-29
    • 2015-09-26
    • 1970-01-01
    • 2013-07-23
    • 1970-01-01
    • 1970-01-01
    • 2014-04-04
    相关资源
    最近更新 更多