This image shows both status bar side-to-side
对于带有侧边菜单的iOS应用程序来说,这看起来非常好.
有关如何实现这一目标的任何想法或方法?
我目前正在使用JASidePanels.
谢谢!
>高度为64点的背景图像将填充两者
UINavigationbar和UIStatusbar.
>高度为44点的背景图像将填充UINavigationbar并离开
UIStatusbar黑色.
>您可以将子视图添加到当前navigationController视图的顶部,它将位于UIStatusbar下方.
因此,首先,您需要使用所需的UINavigationbar外观创建两个图像:
640x128px图像,用于覆盖导航栏和状态栏(ImageA)
并且640x88px图像覆盖导航栏但状态栏保持黑色(ImageB).
在应用程序:dIDFinishLaunchingWithOptions:方法中,使用ImageA设置UINavigationbar的背景[[UINavigationbar appearance] setBackgroundImage:[UIImage imagenamed:@“ImageA.png”] forbarMetrics:UIbarMetricsDefault];
当侧面菜单开始打开时,您将需要切换UINavigationbar,因此它使用ImageB并创建一个视图,您将在UIStatusbar下添加该视图.以下是一些示例代码:
// Add a property for your "temporary status bar" vIEw@property (nonatomic,strong) UIVIEw *temporaryStatusbar;
在侧边菜单开始打开的代码中:
// Create a temporary status bar overlayself.temporaryStatusbar = [[UIVIEw alloc] initWithFrame:[[UIApplication sharedApplication] statusbarFrame]];self.temporaryStatusbar.backgroundcolor = [UIcolor yourcolor];[self.navigationController.vIEw addSubvIEw:self.temporaryStatusbar];// Update both the current display of the navigationbar and the default appearance values[[UINavigationbar appearance] setBackgroundImage:[UIImage imagenamed:@"imageB.png"] forbarMetrics:UIbarMetricsDefault];[self.navigationController.navigationbar setBackgroundImage:[UIImage imagenamed:@"imageB.png"] forbarMetrics:UIbarMetricsDefault];[self.navigationController.navigationbar setNeedsdisplay];
当侧面菜单打开动画时,或者当用户平移菜单时,您需要做的就是调整UIStatusbar叠加层的Alpha级别.当侧面菜单完全打开时,UINavigationbar应该将ImageB作为其背景图像,并且UIStatusbar叠加层的Alpha值为0.当侧边菜单关闭时,您将要用ImageA替换UINavigationbar背景并删除UIStatusbar叠加层.
如果这对您有用,请告诉我!
总结以上是内存溢出为你收集整理的iOS7侧面菜单状态栏颜色过渡.与iOS7 Facebook App一样全部内容,希望文章能够帮你解决iOS7侧面菜单状态栏颜色过渡.与iOS7 Facebook App一样所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)