I created a table view and from there let say a user pressed a cell it will go to the detailItemView , but the only problem right now is that whenever a user is in detailItemView there is no back button even thought I already embed a navigation Controller
Here's the code that will perform a segue once a user pressed a cell:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using [segue destinationViewController].
var nav = segue.destinationViewController as! UINavigationController
var detailScene = nav.topViewController as! DetailViewController
// Pass the selected object to the destination view controller.
if let indexPath = self.tableView.indexPathForSelectedRow() {
let row = Int(indexPath.row)
detailScene.currentObject = objects?[row] as? PFObject
}
}
The screenshot for the storyboard:
edited Screenshot
I tried to do the answer below but there is still no back button
Another screenshot, the detailView controller doesn't have a back button
Embed the TableViewController inside the NavigationController. Not the DetailViewController directly. Check out the screenshot.
Make sure, that the segue, connecting your TableViewController and your DetailViewController is of type Show (e.g. Push). You have to literally push a new View on top of the Navigationstack.