Tabbar iOS Swift
iOS Tab Bar App
In this story we will start with a Single View Application Xcode project.
What we see today.
- How to embed view controller in tab bar controller
- Selected and Unselected tab color
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
1. How to embed view controller in tab bar controller
Start from the very basic simply go to XCode and create a new project. Then select single view app.
After that go to main.storyboard and embed tab bar controller by selecting Editor -> Embed -> Tab bar controller.
After that you will get below screen.
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
2. Selected and Unselected tab color
Till the end of last topic we created a tab bar controller with one tab. Now we will create some more tab to implement Selected and Unselected tab color.
Now, we will add four more view controllers.
Select relationship segue (View Controller) as given below.
>>Add image and title to tabs
For this just select tab of view controller and Bar Item you can give name and image for tab.
>>Selected and Unselected tab color
For that just select tab bar of tab bar view controller. and add keypaths in identity inspector.
For selected tab color add tintColor
For unselected tab color add unselectedItemTintColor
as given below.
after run the app you will get below screen. Thank you!!! Happy coding.