UITabBarController, animation causes sliding of other views without a UINavigationController
I've run into an animation issue (I think) with my TabBar based app. I have four tab bar items, of those three have UINavigationControllers, and one of them just has a regular view controller. The issue is that after changing to a view with animations, the first tab without a UINavigationController seems to no longer have the right size/position when changing bars.
Initially you're able to step through all four tabs without issue, but after the animated view has been used, the first view will appear with a sliding down animation, as if it was positioned incorrectly. Conversely, the other views will "slide up" about 20px when activated. I've got the first view not autosized in the IB, and it has the same height as the other views. I've also tried padding its height by 44px (the height of a NavigationBar) but it showed the same effect.
Also, once this bug is in effect, if another view is activated for the first time; it appears in a weird animated fashion, with its individual elements growing from the bottom left and moving into place.
Any advice is appreciated, I'm inclined to believe it's related to the height or size of that view without a nav controller; or that the animation on my one view isn't being canceled correctly. That view has the following trying to prevent it (but it didn't work):
-(void)viewWillDisappear:(BOOL)animated {
[UIView beginAnimations:nil 开发者_如何学运维context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.1];
[UIView setAnimationCurve: UIViewAnimationCurveLinear];
[UIView commitAnimations];
[super viewWillDisappear:false];
}
The problem had nothing to do with the different views. I had opened an animation block, and not closed it. This won't be caught as a syntax error, but will produce a never ending animation on every transition. If you're seeing the sliding views, I recommend reviewing any place with animation, and confirming the block is closed.
精彩评论