开发者

iPhone UITabBarController

开发者 https://www.devze.com 2022-12-19 01:31 出处:网络
I am using a UITabBarController with 3 items and am curious how to access a method from the first tab if I am on the second or third tab. The problem I am running into is I have a UIImageView on the f

I am using a UITabBarController with 3 items and am curious how to access a method from the first tab if I am on the second or third tab. The problem I am running into is I have a UIImageView on the first tab that is using core animation to loop continuously through 3 images. But when I switch to the second tab and try to switch back to the first tab the program hangs. I discovered if I stop the animation th开发者_如何学JAVAen it will let me switch back to the first tab fine. Any ideas?


You can access view controllers in UITabBarController using its viewControllers property (returns array of controllers) and get the one you need by its index.
The better way, however, is to try to stop animations in controller's -viewWillDisappear: method and resume animations in -viewWillAppear: .

0

精彩评论

暂无评论...
验证码 换一张
取 消