I am trying to create a second view controller and I would like to have the same toolbar with buttons that I created and coded from the first view controller without creating and coding that toolbar again. How can I do that?
Asked
Active
Viewed 84 times
1 Answers
0
A better approach would be to create the toolbar in a parent view controller. You should use a navigation controller embedded in a container view for that.
This is the scene structure of this approach in Interface Builder:
View structure (click to enlarge):
Use an Embed Segue to display the navigation controller in the container view.
You can use delegates to pass actions (e.g. a bar button item was tapped).
Read more about delegates in Swift here.

Tamás Sengel
- 55,884
- 29
- 169
- 223
-
1Yes, I rearranged my storyboard and codes. Finally, it worked! Thanks @the4kman – Nhat Nguyen Nov 21 '17 at 17:49