title: reuse issue in UITableView
body: <p>I have UITableView which covers whole screen (480px).</p>
  
  <p>Each cell is of height 300px.</p>
  
  <p>I have total 5 rows.</p>
  
  <p>Below is the code what I have used.</p>
  
  <pre><code>-(UITableViewCell *) tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MainCell"];
      if (cell==nil) {
          cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MainCell"];
      }
  
      UIButton *myButton = (UIButton *)[cell viewWithTag:999999999];
      int i = indexPath.row+1;
      myButton.tag = i;
      myButton.titleLabel.text = [NSString stringWithFormat:@"B - %d", i];
      [myButton setTitle:[NSString stringWithFormat:@"B - %d", i] forState:UIControlStateNormal];
      NSLog(@"tag set is %d &amp; text for button is =====B-%d====", i,i);
      [myButton addTarget:self action:@selector(btnSelected:) forControlEvents:UIControlEventTouchUpInside];
  
      return cell;
  }
  
  - (int) tableView:(UITableView *) tableView numberOfRowsInSection:(NSInteger)section {
      return 5;
  }
  
  
  -(IBAction)btnSelected:(id)sender {
      UIButton *button = (UIButton *)sender;
      NSLog(@"my tag after click is ===%d", [button tag]);
  }
  </code></pre>
  
  <p>Now when I run this code, I was expecting each cell will have <code>B - 1</code> to <code>B - 5</code> written. However after <code>B - 3</code>, all I see is <code>B - 1</code> and <code>B- 2</code>.</p>
  
  <p>NSLog says as below.</p>
  
  <pre><code>2013-07-28 23:31:34.281 NewTest[1783:11303] tag set is 1 &amp; text for button is =====B-1====
  2013-07-28 23:31:34.284 NewTest[1783:11303] tag set is 2 &amp; text for button is =====B-2====
  </code></pre>
  
  <p>Now when I scroll fully down, I get NSLog as below.</p>
  
  <pre><code>2013-07-28 23:31:34.281 NewTest[1783:11303] tag set is 1 &amp; text for button is =====B-1====
  2013-07-28 23:31:34.284 NewTest[1783:11303] tag set is 2 &amp; text for button is =====B-2====
  2013-07-28 23:32:03.643 NewTest[1783:11303] tag set is 3 &amp; text for button is =====B-3====
  2013-07-28 23:32:03.719 NewTest[1783:11303] tag set is 4 &amp; text for button is =====B-4====
  2013-07-28 23:32:03.835 NewTest[1783:11303] tag set is 5 &amp; text for button is =====B-5====
  </code></pre>
  
  <p>Now when tag and text are set properly why I see last two buttons as B-1 and B-2 instead of B-4 and B-5.</p>
  
  <h2>Any idea how to solve this problem?</h2>
  
  <h2>Screenshot 1</h2>
  
  <p><img src="https://i.stack.imgur.com/MrBOC.png" alt="enter image description here"></p>
  
  <h2>Screenshot 2</h2>
  
  <p><img src="https://i.stack.imgur.com/3Cv2J.png" alt="enter image description here"></p>
  
  <h2>Screenshot 3</h2>
  
  <p><img src="https://i.stack.imgur.com/W8rUp.png" alt="enter image description here"></p>
  
  <p><hr></p>
  
  <h2>Any idea how to solve this problem so that I have B-1 to B-5 written?</h2>
  
  <hr>
  
  <p>Note : If I decrease the height of the cell to 100, I see all button text as B-1 to B-5.</p>
  
  <h2>This question is related to <a href="https://stackoverflow.com/questions/17911314/tag-not-working-in-uitableview">my old question</a>, but this is simpler version.</h2>
  
  <h2><a href="https://www.dropbox.com/s/jc86blei1520209/NewTest.zip" rel="nofollow noreferrer">Sample Project</a></h2>
  
  <hr>
  
  <p>What I did is, not used tag and using accessibilityValue, I am fetching the button clicked id.</p>