Level : WORDPRESS BOOK LINKEDIN PATENT Send Mail 동냥하기 hajunho.com

반응형

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.



반응형
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기