title: Replace tags of selected buttons to the remaining buttons
body: <p>Here there are n <code>UIButtons</code> and when selecting a particular <code>UIButtons</code> it is removed from <code>SuperView</code>. The remaining buttons frame's are moved to this point. Similarly trying to replace the tags of other buttons with selected buttons. This is what I have tried so far.  </p>
  
  <pre><code>-(void)totesttheFunction
  {
      for(int i=0; i&lt;7; i++)
      {
          UIButton *testHere = (UIButton*)[self.view viewWithTag:i];
          if([testHere isSelected])
          {
              int backuptagFor = testHere.tag;
              CGFloat diff = 30.0;
              for(int j=i+1; j&lt;7;j++)
              {
                  UIButton *btnToReplace = (UIButton*)[self.view viewWithTag:j];
                   CGRect setRect = CGRectMake(btnToReplace.frame.origin.x-diff, btnToReplace.frame.origin.y, btnToReplace.frame.size.width, btnToReplace.frame.size.height);
                  btnToReplace.tag = backuptagFor;
                  [testHere removeFromSuperview];
  
              }
          }
      }
  }
  </code></pre>
  
  <p>Here integer variable difference is the difference in frames between two adjacent UIButtons.</p>