I need to change the position of UIButton dynamically. I do this in cellForRowAtIndexPath:. I alter the frame of the button in that method. The change is not di
When drawing UITableViews, table cells are re-used so there is only one instance of a UITableViewCell identified by the string passed to the dequeueReusableCellWithIdentifier:.
If you update the cell in the cellForRowAtIndexPath: method it will not have the effect you expect - each time you will be referring to the same cell (so each cell will have the button in the same position). Hence the problem you are seeing that scrolling makes the button change position.
The easiest thing to fix your problem is alter the code to stop re-using cells by creating a new cell each time in cellForRowAtIndexPath. Update the code like this:
// comment out this line
// cell = [tableView dequeueReusableCellWithIdentifier:identifier];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:nibName];
cell = [nib objectAtIndex:0];
Please note though that re-using cells is preferred for efficiency reasons (to save memory and reduce memory allocations).
Your ideal solution is to create a custom sub-class of UITableViewCell and update the postion of the UIButton in the layoutSubviews method.