tags:

views:

417

answers:

1

I have the need of being able to move a UITextField around within a UITableViewCell. Just to have it in the cell and use it works until I'm trying to actually move it. The problem is that when I try to move it, it does not get repositioned!!!!

I have it added to the cell as a subview of the cell's contentView.

So, I have tried the following and failed them all:

  1. Update the text field's frame to the new origin and size in the -tableView:cellForRowAtIndexPath: method.

  2. Instead of reusing the cell, create a new cell each time and simply set the position the text field where it should be. (Still does not work - amazing!)

  3. Make explicit calls to -setNeedsLayout and -setNeedsDisplay for the cell's content view.

  4. Subclassed the UITableViewCell and overridden -layoutSubviews, just to conclude that the frame of the textfield was exactly as what I wanted. (But it still does not get positioned into that frame!)

Can anyone figure out what is going wrong?!

And, just to be clear, the text field works perfectly in the cell as long I do not have the need to move it! The repositioning of the text field in the cell view is the problem!

A: 

Can you post some relevant code? It's normally just forget one small step.