title: Refresh UIView with Data From Parse
body: <p>On my main page I have created 'cards' that display info saved to Parse.</p>
  
  <p>A user can swipe a card away to reveal a new one behind it.</p>
  
  <p>Here's what I am trying so far:</p>
  
  <pre><code>- (void)viewDidLoad
  {
       [super viewDidLoad];
  
       [self displayProfileInfo];
  
       // I am manually setting NUM_CARDS for now (this needs to be changed to the array of how many objects are in my Parse table though 
       self.cards = [[NSMutableArray alloc] initWithCapacity:NUM_CARDS];
  
       for (int i = 0; i &lt; NUM_CARDS; i++)
       {
           self.cardView = [[CardView alloc] initWithFrame:CGRectMake(self.view.center.x-150, self.view.center.y-160, 300, 360)];
  
           self.cardView.front.layer.backgroundColor = [UIColor darkGrayColor].CGColor;
           self.cardView.back.layer.backgroundColor = self.cardView.front.layer.backgroundColor;
  
           [self.cards addObject:self.cardView];
       }
  
       for (UIView * view in self.cards)
       {
           [self.view addSubview:view];
       }
  
       self.originalPoint = self.view.center;
  }
  
  - (void)displayProfileInfo
   { 
       PFQuery * query = [PFQuery queryWithClassName:@"Profile"]; 
       [query orderByDescending:@"createdAt"]; [query findObjectsInBackgroundWithBlock:(NSArrayobjects, NSError error) {
         if (error)
         {
              NSLog(@"Error: %@ %@", error, [error userInfo]);
         } 
         else
         {
             for (int i = 0; i &lt; objects.count; i++)
             {
                 self.profileObject = [objects objectAtIndex:i];
  
                 PFFile * imageFile = [self.profileObject objectForKey:@"imageFile"];
                 NSURL * imageFileURL = [[NSURL alloc] initWithString:imageFile.url];
                 NSData * imageData = [NSData dataWithContentsOfURL:imageFileURL];
                 self.cardView.profilePicture.image = [UIImage imageWithData:imageData];
  
                 self.cardView.nameLabel.text = [self.profileObject objectForKey:@"fullName"];
                 self.cardView.locationLabel.text = [self.profileObject objectForKey:@"location"];
             }
  
         }
  }]; }
  </code></pre>
  
  <p>I call this method at viewDidLoad and the first object in my table is displayed in the first card.</p>
  
  <p>When I swipe it away, the next card will not load any data.</p>
  
  <p>What's the best way to get the cards to load in the next available information?</p>
  
  <p>EDIT:</p>
  
  <pre><code>PFQuery * query = [PFQuery queryWithClassName:@"Profile"];
  [query orderByDescending:@"createdAt"];
  [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
  
      self.cards = [[NSMutableArray alloc] initWithArray:objects];
  
      for (int i = 0; i &lt; objects.count; i++)
      {
          self.cardView = [[CardView alloc] initWithFrame:CGRectMake(self.view.center.x-150, self.view.center.y-160, 300, 360)];
  
          self.cardView.front.layer.backgroundColor = [UIColor darkGrayColor].CGColor;
          self.cardView.back.layer.backgroundColor = self.cardView.front.layer.backgroundColor;
  
          [self.cards addObject:self.cardView];
      }
  
      for (UIView * view in self.cards)
      {
          // **** CRASHES HERE ****
          // -[PFObject superview]: unrecognized selector sent to instance is what I get
          [self.view addSubview:view];
      }
  
      if (error)
      {
          NSLog(@"Error: %@ %@", error, [error userInfo]);
      }
      else
      {
          for (int i = 0; i &lt; objects.count; i++)
          {
              self.profileObject = [objects objectAtIndex:i];
  
              PFFile * imageFile = [self.profileObject objectForKey:@"imageFile"];
              NSURL * imageFileURL = [[NSURL alloc] initWithString:imageFile.url];
              NSData * imageData = [NSData dataWithContentsOfURL:imageFileURL];
              self.cardView.profilePicture.image = [UIImage imageWithData:imageData];
  
              self.cardView.nameLabel.text = [self.profileObject objectForKey:@"fullName"];
              self.cardView.locationLabel.text = [self.profileObject objectForKey:@"location"];
          }
  
      }
  }];
  </code></pre>
  
  <p>Here is the new code, and here is what I see in the console:</p>
  
  <blockquote>
    <p>-[PFObject superview]: unrecognized selector sent to instance ...</p>
  </blockquote>
  
  <p>So this still needs resolving:</p>
  
  <pre><code>PFQuery * query = [PFQuery queryWithClassName:@"Profile"];
  [query orderByDescending:@"createdAt"];
  [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
  
      self.cards = [[NSMutableArray alloc] initWithArray:objects];
  
      for (int i = 0; i &lt; objects.count; i++)
      {
          self.cardView = [[CardView alloc] initWithFrame:CGRectMake(self.view.center.x-150, self.view.center.y-160, 300, 360)];
  
          self.cardView.front.layer.backgroundColor = [UIColor darkGrayColor].CGColor;
          self.cardView.back.layer.backgroundColor = self.cardView.front.layer.backgroundColor;
  
          self.profileObject = [objects objectAtIndex:i];
  
          PFFile * imageFile = [self.profileObject objectForKey:@"imageFile"];
          NSURL * imageFileURL = [[NSURL alloc] initWithString:imageFile.url];
          NSData * imageData = [NSData dataWithContentsOfURL:imageFileURL];
          self.cardView.profilePicture.image = [UIImage imageWithData:imageData];
  
          self.cardView.nameLabel.text = [self.profileObject objectForKey:@"fullName"];
          self.cardView.locationLabel.text = [self.profileObject objectForKey:@"location"];
  
          [self.cards addObject:self.cardView];
  
          [self.view addSubview:self.cardView];
      }
  
      if (error)
      {
          NSLog(@"Error: %@ %@", error, [error userInfo]);
      }
  
  }];
  </code></pre>