Started a new tabbed IOS project on Xcode and it gave me two tabs, each with their own sections for code (i.e. FirstViewController.swift & SecondViewController.swift). However when I add new view controllers they do not have these sections, can someone please tell me how to do this?
Replies
Very simple:
- create a new file, select Cocoa Touch class
- define it as ThirdViewController and as subclass of UIViewController
- create a new ViewController in IB
- put a label on it to understand where you are when you get there
- Set the class (via the identity inspector of IB) as ThirdViewController
- Control-drag from the TabBarViewController (in the middle of the view, grey area) to ThirdViewController.
- Select relationship segue
- Select the tabbar at the bottom of ThirdView
- In the Attributes Inspector, select an icon image in Bar Item (lower part of Attributes Inspector)
Then a third tab appears …
Did you make it work ? Or is there a remaining problem ?
It worked, thanks alot 🙂
Great. Thanks for the feedback.
Don't forget to close the thread.