0

An UIPicker shows up when I select a row in a table, so I can choose some things I want to be displayed on the same row.

How can I update the table once I finished with the uipicker? I used reloadData right after the call to the picker, but the code is executed before I do "Done" on the picker.

Some idea?

Thank u

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
Guille10k
  • 11
  • 2
  • try reload data on "Done" handle? You should provide more details on what are you doing - how you show UIPicker, what that "Done" is etc... – Vladimir May 11 '10 at 14:24
  • Done is just the button I use to confirm my selection in the uipicker. The UIPicker is defined in a class separated from the table, and I call it with [actionSheet showInView:self.view], [actionSheet addSubview:pickerView];. – Guille10k May 11 '10 at 14:53

1 Answers1

1

USe the UIPicker delegate method pickerView:didSelectRow:inComponent:, and call reloadData from your delegate.

The object with your "done" action should be the delegate of the UIPicker, and implement the delegate method above. In that delegate method call reloadData. It will be called when the picker is done.

Paul Lynch
  • 19,769
  • 4
  • 37
  • 41
  • I've seen where the problem is, I could use didSelectRow or clickedButtonIndex, but what I need is how to call the reloadData from there, as the UIPicker is defined in a different class from the table. thank u – Guille10k May 11 '10 at 14:59
  • Maybe the best question would be: How do I call reloadData from my UIPicker class? (which is outside the tableview controller I want to update). The easy way is joining the two classes. – Guille10k May 11 '10 at 19:28
  • You do that by implementing the delegate method. Really. – Paul Lynch May 11 '10 at 23:02