title: How to select and deselect the thumbnail images and selected image store in array in iphone
body: <p>I am new to i phone programming.I have create custom button inside that i am attaching images for each and every custom button.Now that custom button images is displaying in thumbnail.Now what i want if i select any thumbnail image or custom button.Here i want to select and deselect that thumbnail images  and I want to store that selected images tag value in array.How to do this Below one my code.Using below code i am creating custom button and attaching image to custom button.</p>
  
  <pre><code>blaukypath =[[NSMutableArray alloc]init];
     for (NSString* path in array)
     {
   [blaukypath addObject:[UIImage imageWithContentsOfFile:path]];
   NSLog(@"%@",path);
     }
    myScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0.0, 0.0, 320.0, 840.0)];
    myScrollView.delegate = self;
    myScrollView.contentSize = CGSizeMake(320.0, 840.0);
    myScrollView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:myScrollView];
  
    float horizontal = 8.0;
    float vertical = 8.0;
    for(int i=0; i&lt;[blaukypath count]; i++)
    {
     if((i%4) == 0 &amp;&amp; i!=0)
     {
     horizontal = 8.0;
     vertical = vertical + 70.0 + 8.0;
     }
  
                      buttonImage = [UIButton buttonWithType:UIButtonTypeCustom];
                      [buttonImage setFrame:CGRectMake(horizontal, vertical, 70.0, 70.0)];
                      [buttonImage setTag:i];
  
                      [buttonImage setImage:[blaukypath objectAtIndex:i] forState:UIControlStateNormal];
                      [buttonImage addTarget:self action:@selector(buttonImagePressed:) forControlEvents:UIControlEventTouchUpInside];
                      [myScrollView addSubview:buttonImage];
  
                      horizontal = horizontal + 70.0 + 8.0;
                  }
  
                  [myScrollView setContentSize:CGSizeMake(320.0, vertical + 78.0)];
  
  
                  [self.myScrollView addSubview:buttonImage];
  </code></pre>
  
  <p>Now if select any thumbnail image i want to select and deselect the thumbnail images and selected thumbnail images i want to store in array.</p>
  
  <pre><code>-(void)buttonImagePressed:(id)sender
  {
  UIButton *btn = (UIButton*)sender;
  
      if (btn.tag==0)
      {
          [btn setImage:[UIImage imageNamed:@"Default.png"] forState:UIControlStateNormal];
          btn.tag=1;
      }
      else{
          [btn setImage:nil forState:UIControlStateNormal];
          btn.tag=0;
      }
  </code></pre>
  
  <p>some body told that by using above code i will work for but i not working Exactly what i want.i want to select and deselect and also selected images i want to store in array.
  Thanks
  Aslam</p>