Reputation: 1
I am following this tutorial, and I am trying to add a "bar button". the tutorial says the following :
While you’re there, change the title of the screen to Add Player (by double-clicking in the navigation bar). Also add two Bar Button Items to the navigation bar. In the Attributes inspector, set the Identifier of the button to the left to Cancel, and the one on the right to Done (also change this one’s Style from Bordered to Done).
I followed the steps, but every time i drag the "bar button" to place it on the navigation bar, it moves automatically to the lower left of the scene as shown in image-1
please let me know the following
1- how to place the bar button on the navigation bar
2- how to rename "Root View Controller" to "Add Player"
image-1:
Upvotes: 0
Views: 549
Reputation: 8322
Disable translucent property of navigationBar of NavigationController in storyboard.
if you have enabled translucent then you not able drag bar item to navigationBar .
Now you able to drag Bar item to Navigation bar through story board.
Upvotes: 1
Reputation: 2149
Just do the following from the beginning.:(
Sorry to say that.
Take a view controller.embed it to navigation controller.
How?
Select your view controller and from
then go to there and select bar button item and keep that bar button item to navigation bar.
Double click your navigation controller and write "Add player" for naming
i hope you get this.
Upvotes: 0
Reputation: 168
Change Students -> "Add Player". This wil rename "Root View Controller"
You can also set the bar button programmatically. Try this:
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: #selecter(function), action: nil)
Upvotes: 0