Last active
April 13, 2022 09:53
-
-
Save gaeng2y/8ea744e1d63e2880b9591465ef3a3975 to your computer and use it in GitHub Desktop.
addVC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UITabBarController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view. | |
self.view.backgroundColor = .white | |
self.tabBar.tintColor = .systemPink | |
self.tabBar.backgroundColor = .systemGray5 | |
addVC() | |
} | |
private func addVC() { | |
let firstVC = UIViewController() | |
firstVC.view.backgroundColor = .systemGreen | |
firstVC.title = "First" | |
firstVC.tabBarItem = UITabBarItem(title: "First", image: UIImage(systemName: "1.circle"), selectedImage: UIImage(systemName: "1.circle.fill")) | |
let secondVC = UIViewController() | |
secondVC.view.backgroundColor = .systemPurple | |
secondVC.title = "Second" | |
secondVC.tabBarItem = UITabBarItem(title: "Second", image: UIImage(systemName: "2.circle"), selectedImage: UIImage(systemName: "2.circle.fill")) | |
self.viewControllers = [firstVC, secondVC] | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment