我正在构建一个具有图片查看功能的应用程序。我已经将 UIScrollView 野兽摔倒在地(希望发布我的滚动视图知识 RSN),现在正在尝试复制 iPhone 照片应用程序的其他一些视觉效果。具体来说,在查看图像时,我想将控件和栏溶解掉。
我有一种方法可以切换状态栏、导航栏和标签栏的可见性,只留下带有图像的滚动视图。滚动视图是全屏的。我有一个计时器,它在用户执行某些操作(单击屏幕、查看下一个图像等)后 3 秒触发,在 timerFired 方法中,我调用我的方法来关闭条形图。单击屏幕即可打开条形图。这是切换全屏状态的方法。
- (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];
}
}
这基本上可行,但是,它看起来不如照片应用程序好。我正在为 alpha 值设置动画,因为我相信这看起来更像照片应用程序,而不是使用可用的隐藏动画方法。我的问题是对状态栏做同样的事情。
我的问题:(1)状态栏有 UIView 吗?(2)有没有办法改变状态栏的alpha属性?(3) 是另一个UIWindow中的状态栏吗?(4)有没有另一种使用“合法”方法来实现这一点(我需要把这个应用程序放在应用商店)?
我已经转储了 UIApplication 的 windows 属性,并且只有 1 个窗口,并且我已经爬取了视图层次结构,并且状态栏没有明显的视图。
有任何想法吗?