iOS JASidePanel状态栏自定义
我在我的应用程序中使用JASidePanels ,一切都非常好。 我的devise团队已经拿出了这样的UIdevise,当侧面板显示或显示,
但是我能重现像! 这个。
到目前为止,我所尝试的都是:
我试图设置中心面板的背景颜色,我在右侧面板中的图像 – 没有运气。
我尝试设置sidePanel.view.backgroundColor和tintColor – 没有运气。
任何帮助表示赞赏!
这是JASidePanels的bug,但是他们通过这样做解决了这个问题:在JASidePanelsController中,将以下代码添加到_adjustCenterFrame
- (CGRect)_adjustCenterFrame { CGRect frame = self.view.bounds; if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) { if (![UIApplication sharedApplication].statusBarHidden) { frame.origin.y = frame.origin.y + [UIApplication sharedApplication].statusBarFrame.size.height; frame.size.height = frame.size.height - 20; } } ... }
同样在_layoutSideContainers
添加:
- (void)_layoutSideContainers:(BOOL)animate duration:(NSTimeInterval)duration { CGRect leftFrame = self.view.bounds; CGRect rightFrame = self.view.bounds; if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) { if (![UIApplication sharedApplication].statusBarHidden) { leftFrame.origin.y = leftFrame.origin.y + [UIApplication sharedApplication].statusBarFrame.size.height; rightFrame.origin.y = rightFrame.origin.y + [UIApplication sharedApplication].statusBarFrame.size.height; leftFrame.size.height = leftFrame.size.height - 20; rightFrame.size.height = rightFrame.size.height - 20; } } ... }
参考:
https://github.com/hamin/JASidePanels/commit/81ae7514d275d9242ad268ab818441c8d786a63e
和
我尝试了一个基于JASidePanels的演示源代码的简单testing。 并得到这个效果:
如果这不是您想要的,请忽略此答案并将其删除。
它通过修改JASidePanels的源代码来工作:
为了testing,我添加self.window.backgroundColor = [UIColor redColor]
在你的情况下,你可以添加[self.window addSubview:backgroundImageView]
或jaSidePanelController.view addSubview:backgroundImageView
(请自己testing一下)
然后通过添加额外的空间来调整左侧面板的框架的大小,让左侧面板不会覆盖状态栏的背景图像视图。 在JASidePanelController#_layoutSidePanels
PS:有关更多详细信息,请阅读有关iOS 7状态栏的文章,如http://www.doubleencore.com/2013/09/developers-guide-to-the-ios-7-status-bar/
顺便说一句:我很好奇,在你的截图中没有cornerRadius
。
只需在JASlidePanelController.m文件中设置cornerRadius 0.0f即可:
- (void)stylePanel:(UIView *)panel { //do changes in below cornerRadius panel.layer.cornerRadius = 0.0f; panel.clipsToBounds = YES; }