iOS, Changing the tab bar selected image
Basically tab bar provides the default case when the image is selected. sometimes we want to change its color or image. I was looking for changing image when it is selected. but A lot of information on the web is to change color.
here are the codes who like the same as I want.
class ViewControllerUITabBar: UITabBarController, UITabBarControllerDelegate {
.
.
.
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
GS.s.selectedTab = tabBarController.selectedIndex
case 2:
tabBar.selectedItem?.selectedImage = imageLiteral(resourceName: "img_message_warning")
You have to change the image in the assets to be the original image if you want the icon remains as the same image.