title: Removing an object from an NSMutableArray xcode
body: <p>The idea is that there are multiple objects being created and the one that was first created will get deleted first when a button is clicked and so on. For example it would create objects # 1 then 2 then 3 and when the button is clicked the first time it will first delete 1, then 2, then 3. </p>
  
  <p>Here is my code for the creation of the items in the array:</p>
  
  <pre><code>//array of imageviews
  aryImages= [[NSMutableArray alloc] init];
  //creation code for the images
  CGRect frame = CGRectMake(480, 180, 60, 55);
  imgViewPicture = [[UIImageView alloc] initWithFrame:frame];
  imgViewPicture.image=[UIImage imageNamed:@"flower.png"];
  [self.view addSubview:imgViewPicture];
  
  [aryImages addObject:imgViewPicture];
  </code></pre>
  
  <p>Then here is the movement code</p>
  
  <pre><code>for (int x = 0; x &lt; [aryImages count]; x++) {
      [UIView beginAnimations:nil context:nil];
      [UIView setAnimationDuration:1.5];
      [UIView setAnimationCurve:UIViewAnimationCurveLinear];
      [UIView setAnimationDelegate:self];
      [imgViewPicture setFrame:CGRectMake(120, 180, 60, 55)];
      [UIView commitAnimations];
  }
  </code></pre>
  
  <p>Here is the code for deleting the items beyond the certain x location:</p>
  
  <pre><code> for (int x = 0; x &lt; [aryImages count]; x++) {
          UIImageView *imgViewInQuestion = (UIImageView *)[aryImages objectAtIndex:x];
          if (imgViewInQuestion.frame.origin.x&gt;=120) {
              [aryImages removeObjectAtIndex:x];
          }
      }
  </code></pre>
  
  <p>Unfortunately this does not work. Any ideas why or possible solutions for me? </p>