I want the TabBarController icon to be original in Swift.

Asked 2 years ago, Updated 2 years ago, 63 views

I want the TabBarController icon to be original, but I can only find the one using storyboard or Object-C on various sites.

What kind of program should I write to make the icon original?

swift xcode

2022-09-30 20:48

1 Answers

You can only find things using storyboard or Object-C on various sites.

Most iOS app development information is based on Objective-C, and it is not reasonable to exclude them from the survey just because they are "different languages."I'm not asking you to learn Objective-C now.In most of the information, regardless of language, there should be parts that explain the general flow of work and processing, so wouldn't it be helpful to read just that part?

A quiet talk.

The Tab Bar Item (icon image + title string) displayed in the Tab Bar belongs to the View Controller.Therefore, changing the icon is the process of sending a method to the View Controller or changing the properties of the View Controller.
If the instance name of this View Controller is hogeViewController, then

hogeViewController.tabBarItem=UITabBarItem(title: "hoge", image:UIImage(named: "hoge.png", tag:0)

This changes the Tab Bar Item title to "hoge" and the icon to "hoge.png."


2022-09-30 20:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.