Here is my code. I want to put a back button on the opening rootviewController.
- (void)selectSurah:(id)sender {
SurahTableViewController * surahTableVi
Appearance and behavior of a back button in a UINavigationController relies on interaction between a stack of UINavigationControllers. Putting a back button on the first controller breaks this convention, there's nothing to go back to, which is why your code isn't working.
You'll need to manually add UIBarButtonItem to the title bar code like:
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(back:)];
If you truly want it to look like a back button, you'll need to manually create the UIBarButtonItem with an image that mirrors the back button.
Another suggestion though, as it looks like you are attempting to use a back button to dismiss a modal view controller, I'd stick with something more conventional like a "Close" or "Done" button to close the modal view controller. A back button is really more appropriate for navigating a stack of UINavigationControllers.