how do I duplicate animation from iPhone photos app
I am building an app that has picture viewing capabilities. I have wrestled the UIScrollView beast to the ground (hope to post my scrollview knowledge RSN) and am now trying to duplicate some of the other visual effects of the iPhone photos app. specifically, when viewing an image, I would like to dissolve the controls and bars away.
I have a method that toggles visibility of the status bar, navigation bar, and tab bar, leaving just the scrollview with an image. The scrollview is full screen. I have a timer that fires 3 seconds after the user does something (single taps the screen, views the next image, etc.) and in the timerFired method, I call my method to turn off the bars. a single tap of the screen turns on the bars. here's the method to toggle the full screen state.
- (void)setFullScreen:(BOOL)fullScreen {
// reset the timer
[myTimer invalidate];
[myTimer release];
myTimer = nil;
// start animation section
[UIView beginAnimations:nil context:nil];
// toggle the status bar
[[UIApplication sharedApplication] setStatusBarHidden:fullScreen animated:YES];
[UIView setAnimationDuration:UINavigationControllerHideShowBarDuration];
CGFloat alpha = fullScreen ? 0.0 : 1.0;
// change the alpha to either 0 or 1 based on hiding or showing the bars
self.navigationController.navigationBar.alpha = alpha;
self.tabBarController.tabBar.alpha = alpha;
// do the animations!
[UIView commitAnimations];
// restart the timer after we show the bars
if (!fullScreen) {
myTimer = [[NSTimer timerWithTimeInterval:3.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:NO] retain];
[[NSRunLoop currentRunLoop] addTimer:myTimer forMode:NSDefaultRunLoopMode];
}
}
This basically works, BUT, it doesn't look as good as the photos app. I am animating the alpha values as I believe that this looks more like the photos app instead of the using the hidden with Animation methods available. My problem is doing the same for the status bar.
my questions: (1) is there a UIView for the the status bar? (2) is there a way to change the alpha property of the status bar? (3) is the statusbar in another UIWindow? (4) is there another way to achieve this using "legal" methods (I need to put this app in the app store)?
I've dumped the windows property of the UIApplication and there was only 1 window and I've crawled the view hierarchy and there was not an obvious view for the status开发者_运维知识库 bar.
any ideas?
The status bar is created by SpringBoard itself, it is of class SBStatusBar (which IIRC inherits from UIWindow). It is not accessible to app store applications.
精彩评论