IPhone UITabBarController

I am using a UITabBarController with 3 elements and I am wondering how to access the method from the first tab if I am on the second or third tab. The problem I am facing is that I have a UIImageView on the first tab, which uses the main animation for a continuous loop through 3 images. But when I switch to the second tab and try to switch to the first tab, the program freezes. I found that if I stop the animation, this will allow me to return to the first tab. Any ideas?

+3
source share
1 answer

You can access the view controllers in the UITabBarController using its property viewControllers(returns an array of controllers) and get the one you need by its index.
However, it’s best to try to stop the animation in the controller method -viewWillDisappear:and resume the animation in -viewWillAppear:.

+3
source

Source: https://habr.com/ru/post/1731552/


All Articles