English 中文(简体)
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.

问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签