I have a view controller that is embed in a navigation controller, and inside it there is a button that shows another view controller, like this:
In the second view controller, the value of self.navigationItem.backBarButtonItem
is nil, why please?
Though I can see the back button when I run the app, like this:
I read that the back button in a view controller, is the responsibility of the navigation item of the previous view controller, and to be more presise, it is the responsibiliyt of the navigation item in the previous view controller.
so i tried to do this in the first view controller:
self.navigationItem.backBarButtonItem!.title = "Wdd"
but i got exception because backBarButtonItem is also nil in the first view controller.
Guys look here please
there is this sentence
The navigation item associated with the current view controller provides the content for the center and right positions of the navigation bar. The navigation item for the previous view controller provides the content for the left position
I found the solution myself.
In the firstVC i do this in view did load:
backButton.title = "ddddd"
self.navigationItem.backBarButtonItem = backButton
and it works
i got the answer after this image :