In this example.
I am animating a PhotoViewerViewController frame when I am animating a tabBarController (for full screen effect). PhotoViewer uses uiscrollview to create the same effect as Apple photos. For some reason, sometimes it is animated with my PhotoViewer framework, and sometimes not.
In the first example, you can see that it increases with increasing frame size, but it improves noticeably with decreasing frame size (and restoring the tab bar).
However, in this example, when the photo is vertical, it jumps in both directions.
In both cases, if I enlarge the photo on the scroll screen at all, it animates correctly in both directions.
I know that there is evidence, but I can not say what is happening here.
Here is my animation block:
void (^updateProperties) (void) = ^ { self.navigationController.navigationBar.alpha = hidden ? 0.0f : 1.0f; self.navigationController.toolbar.alpha = hidden ? 0.0f : 1.0f; if (self.tabBarController) { int height = self.tabBarController.tabBar.bounds.size.height; for(UIView *view in self.tabBarController.view.subviews) { int newHeight; UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; if (UIInterfaceOrientationIsPortrait(orientation)) { newHeight = hidden ? [[UIScreen mainScreen] bounds].size.height : [[UIScreen mainScreen] bounds].size.height - height; } else { newHeight = hidden ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.width - height; } if([view isKindOfClass:[UITabBar class]]) { [view setFrame:CGRectMake(view.frame.origin.x, newHeight, view.frame.size.width, view.frame.size.height)]; } else { CGRect newFrame = CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, newHeight); [view setFrame:newFrame];
Code adapted from SO: UITabBar message will not be hidden
Full github source.
Bob spryn
source share