Skip to content

Instantly share code, notes, and snippets.

@gaeng2y
Last active April 13, 2022 09:53
Show Gist options
  • Save gaeng2y/8ea744e1d63e2880b9591465ef3a3975 to your computer and use it in GitHub Desktop.
Save gaeng2y/8ea744e1d63e2880b9591465ef3a3975 to your computer and use it in GitHub Desktop.
addVC
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