I’m a little confused as to how I should be using didSelectRowAtIndexPath.
Without using datasources (keeping things simple),if you display a list of names with UITableView and all you want to do is select a name and return it to whatever parent view controller created the UITableView list.. what would you do?
I’m used to Windows MFC programming where you have a dialog class and you call DoModal() to display the dialog and then query member variables of that dialog object to get the results.. With iPhone programming I’m confused with the whole paradigm. I push the UITableView into action, but at what point should I try and retrieve the results? pushViewController is asynchronous in nature isn’t it? So I can’t expect to retrieve results on the line immediately following the pushViewController method?
I’m using NSMutableArrays of NSStrings to keep things simple.
The patter you are going to use is called
delegation, what happens is that you call the newViewControllerand let it do its work, the function that called this will return normally,Now you need to implement
didSelectRowAtIndexPathand get theselectedRow, after this you will need to return the selected index or value to the original view controller( this will be recieved in another function) please read more about @protocol and delegateion