Quote:
Originally Posted by tfritsch
I am trying to create a view that poses a question in a label and has a subview of a table for multiple choice answers. The view controller is set as the tableview DataSource and Delegate.
Currently, the form displays correctly and when the user clicks on an answer in the table, I can get it to change to the next question and update the table with the new multiple choices. (i.e., the table is acting as the navigation control). This works well but not the best for user experience and overall UI navigation consistency with the rest of the app.
What I would prefer is to not have the table working as a navigation control. To instead place a checkmark next to the answer and then have a button that will move to the next question and reload the table.
So, the button will call -(void) showNextQuestion which gets the new data and updates the view labels for the question. I try to call [self.tableView reloadData] but it is not declared outside of the predefined methods for the tableviewController.
So basically, how can I show a simple list of values in a subview table on a view, allow a selection to occur, providing the index of the item selected and have a button that will update the contents of that table?
I have thought aboutputting the button inside of the table but I want the navigation to stay with a button on the view.
Any ideas or direction would be appreciated.
|
What you describe should work. What do you mean when you say "... but it is not declared outside of the predefined methods for the tableviewController."
Is your view controller a subclass of UITableView? It should be. Note that you can manage a table view yourself. You don't have to have a table view controller. A table view controller doesn't do much, and that behavior is easy to duplicate.
A UITableViewController has a property TableView. You can (and should) use a subclass of UITableViewController to manage your entire screen, including the buttons, labels, etc. The special tableview methods will take care of the housekeeping methods for the table view, and your custom methods will manage everything else.