Question

I have created a UISearchDisplayController which uses a separate UITableViewController as the delegate to display the results of the search. In this view controller, I have the 'didSelectRowAtIndexPath' method which allocates and initializes a detailViewController then uses:

[[self navigationController] pushViewController: detailViewController animated: YES];

to push it onto the stack. However, this line doesn't work. When a cell is tapped, nothing happens. 'didSelectRowAtIndexPath' is being called, but the 'pushViewController' method call isn't working. Am I not in the context of my navigationController any more? How can I fix this problem?

Any help would be much appreciated.

Was it helpful?

Solution

your table's navigationController is probably the wrong one, I think that you might want to push it on the navigationController of your UISearchDisplayController. To do this, you can create a protocol in your tableviewcontroller with a method "pushViewController" for instance and have UISearchDisplayController implement it.

Then your register this delegate in your table view and you call your delegate on pushViewcontroller in your 'didSelectRowAtIndexPath'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top