

Tab Bar Controller iOS Tutorial
source link: https://www.tuicool.com/articles/hit/NZZbaan
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

The UITabBarController class implements a specialized view controller that manages a radio-style selection interface. This tab bar interface displays tabs at the bottom of the window for selecting different views. In this Tutorial a Tab Bar Controller will be created and by default two Tab Bar Items will be included. The third Tab Bar Item will be added using the Storyboard. This tutorial is made with Xcode 10 and built for iOS 12.
Open Xcode and create a new Tapped App.

For product name, use IOS12TabBarControllerTutorial and then fill out the Organization Name and Organization Identifier with your customary values. Enter Swift as Language and choose Next.

For the Tab Bar items some custom images will be used.Download the images, unzip them and add the images to the Assets Library. Go to the Storyboard. In the Document Outline select the First Bar button Item in the First Scene and go to the Attribute Inspector. In the Bar Items section change the title to "Red" and select the book image.

Repeat this step for the Second Bar Item of the Second View Controller. Name it "Blue" and select the clock image.

Select to the Red View and change the Background to red using the Attributes Inspector. In the blue view change the Background to blue. Also remove the Labels inside the view.

The Storyboard should now look like this.

Build and Runthe project, and change views by clicking the Tab Bar Items.

Next, we will add another Tab Bar Item inside the Storyboard. Drag a View Controller from the Object Library to the Scene. Select the View Controller and go to the Attribute Inspector. Change the Background color to Green. Next Ctrl and Drag from inside the Tab Bar Controller to the newly created View Controller and select "view controllers" in the Relationship Segue section.

In the Document Outline select the Tab Bar Item in the Item Scene and Go to The Attribute Inspector. In the Bar Items section change the title to "Green" and select the crown image.

Build and Runthe project, the 3 Tab Bar Items will be visible. By clicking the Icons the Views will change.

You can download the source code of the IOS12TabBarControllerTutorial at the ioscreator repository on Github .
Recommend
-
118
在APP中,Tab Bar是固定好还是不固定好? 我要投稿 推荐:
-
10
How to design a better bottom navbar (Tab bar)?Tips, best practices and important points for creating a navigation system.There are considerable ways in which you can style, list, and showcase...
-
10
Control the tab bar color in Safari 15 Sep 21, 2021 | 1 min read | macOS, iPadOS,
-
17
Iconic Tab Bar 0 unsaved changes xxxxxxxxxx<nav class="menu"> <input type="radio" name="nav-item"...
-
8
React Native Tabbar Interaction Beautiful Tabbar Interaction with Sliding Inset FABs, made with React Native. Check it out on Béhance (
-
6
Bottom Tab Bar Design Best Practices...
-
9
You can easily support sarunw.com by checking out this sponsor.
-
5
How to change a Tab Bar item color in SwiftUI 24 Oct 2022 ⋅ 3 min read ⋅ SwiftUI
-
7
Tabs Fancy bottom tab bar animation using SVG masks Oct 30, 2022 1 min read
-
15
UI界面的Tab bar动态设计提示 1月 18, 2023 发表于: 交互设计.
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK