Animate UITabBarView item icon in iOS with swift 5

Animate UITabBarView item icon in iOS with swift 5
July 14, 2020 No Comments Development,iOS Development Pushpendra Kumar

Hey, Guys welcome to this tutorial. In this complete video, I will make you understand the quick trick. And trick stated as How to Animate UITabBarView item icon in iOS with swift 5. And this is a simple way to achieve our goals. Through this simple video tutorial, you can learn more interesting things about the Animate UITabBarView item icon in iOS with swift 5. So watch the complete video. And if you watched the complete video then do not forget to give your suggestion into the comment box. Because your feedback & suggestions do matter for me 😊😊😊😊👇🏻

And finally, I would like to say that, If you like this video and it’s helpful for your project then click on the like button and do not forget to subscribe to this YouTube channel for future updates. 

Animate UITabBarView item

        var itemView = self.tabBar.subviews[0]
        self.image1 = itemView.subviews.first as? UIImageView
        self.image1.contentMode = .center
        
        itemView = self.tabBar.subviews[1]
        self.image2 = itemView.subviews.first as? UIImageView
        self.image2.contentMode = .center
        
        itemView = self.tabBar.subviews[2]
        self.image3 = itemView.subviews.first as? UIImageView
        self.image3.contentMode = .center
        
        itemView = self.tabBar.subviews[3]
        self.image4 = itemView.subviews.first as? UIImageView
        self.image4.contentMode = .center

Great! 

    override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
        if item.tag == 1 {
            self.image1.transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
            UIView.animate(withDuration: 0.5, animations: {
                self.image1.transform = .identity
                self.image1.transform = CGAffineTransform(rotationAngle: .pi/2)
            })
            
        }else if item.tag == 2 {
            self.image2.transform = CGAffineTransform(scaleX: 0.5, y: 0.5)
            UIView.animate(withDuration: 0.5, animations: {
                self.image2.transform = .identity
                self.image2.transform = CGAffineTransform(rotationAngle: .pi/2)
            })
        }else if item.tag == 3 {
            self.image3.transform = CGAffineTransform(scaleX: 1.5, y: 1.5)
            UIView.animate(withDuration: 0.5, animations: {
                self.image3.transform = .identity
                self.image3.transform = CGAffineTransform(rotationAngle: .pi/2)
            })
        }else if item.tag == 4 {
            self.image4.transform = CGAffineTransform(scaleX: 5, y: 5)
            UIView.animate(withDuration: 0.5, animations: {
                self.image4.transform = .identity
                self.image4.transform = CGAffineTransform(rotationAngle: .pi/2)
            })
        }
    }

Good job… I hope you follow the complete tutorial and you have done with the animation.

In Conclusion, You have done with this tutorial. And I hope now the concept of Animate UITabBarView item icon is clear. Firstly, If you have any doubts regarding the Animate UITabBarView item icon in iOS with Swift 5. Then you can comment into the comment box. And If you like this tutorial with a complete description of the simple and attractive tutorial in iOS then please like my video on YouTube and do not forget to subscribe to my YouTube channel. Because you will get lots of videos related to swift development with very sort tricks.

In addition, If you are more curious about the development and knowing about tutorials then follow the below links 👇🏻👇🏻👇🏻😎

Tags
About The Author
Pushpendra Kumar I am passionate about mobile application development and professional developer at Colour Moon Technologies Pvt Ltd (www.thecolourmoon.com). This website I have made so that I can meet with new challenges and can share here.

Leave a reply

Your email address will not be published. Required fields are marked *