cells order changes in UITableView after reloadSections: method

Posted by user304895 on Stack Overflow See other posts from Stack Overflow or by user304895
Published on 2010-03-30T08:29:59Z Indexed on 2010/03/30 8:33 UTC
Read the original article Hit count: 493

I'm having a problem using a grouped UITableView, and after 3 days of searching, I didn't found the solution...
Actually, I have a Grouped table, composed of two sections :
The first section contains a UISegmentedControl with three buttons : button0, button1 and button2.
When clicking on the button0, I want to show two cells in the second section, with embedded UITextField in each cell.
When clicking on the button1, I want to show one cell in the second section with an embedded UITextField.
When clicking on the button2, I have to show the camera in ModalView (I think it will be ok).
I've also put placeholders in each UITextField.

Each time a button is clicked, I call a pickOne: method in order to update my view. In this method, I construct a NSIndexSet with NSRange of (1, 1), and then I call the reloadSections: method from the UITableViewController with NSIndexSet as a parameter.
When the view appears for the first time, everything is ok, but when I click many times on the buttons, the order of the cells changes (cells containing the two textFields for the button0), and the new placeHolders are written over the old ones. Even more, sometimes when I click on the button0, it shows me only the second cell...

Do you have any idea ? or need some code ?

Thank you :)

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uitableview