Closed kenhama closed 9 years ago
Just did a little digging and it seems like when you set the call windowLevel = UIWindowLevelStatusBar;
on a UIWindow, it creates the status bar even if you don't have it defined. I'll file an issue with Apple later today to see if they can fix that.
Hey guys, I have created a pull request 'fixing' the appearance of the status bar (I don't think it will be fixing the hide/show statusbar operation).
If you are happy with this change and it can help you dealing with the hide/show issue as well, feel free to merge it. Or let me know if we can solve this issue in a different way.
Cheers!
Here is the pull request: https://github.com/conopsys/COSTouchVisualizer/pull/16
@rodrigoelp et al, even on 1.0.5 (which includes #16) I'm having trouble hiding the status bar when using COSTouchVisualizerWindow
. prefersStatusBarHidden
never gets called on my view controllers. Not sure that I'll have time to investigate, but if I do, I'll post here.
@johnboiles as mentioned before, I didn't think it was going to fix the statusbar show/hide. It appears the status bar gets recreated when the new window is initialized, causing it to render it ignoring the project configuration or the ViewController settings.
I guess we can do the same workaround/hack that the preferredStatusBarStyle
(fetching the default for the rootViewController
and return it for the overlayViewController
) but I don't think that will fix your problem if you are overriding it for a specific view controller. Could you try this for me?
Go to the line 29 on master (it will be easier to change it on your cocoapod to test with your application, I don't know which line number that would be in the pod though) and replace the implementation of COSTouchOverlayWindowViewController
with
@implementation COSTouchOverlayWindowViewController
- (UIStatusBarStyle)preferredStatusBarStyle {
return [UIApplication sharedApplication].keyWindow.rootViewController.preferredStatusBarStyle;
}
- (BOOL)prefersStatusBarHidden {
return [UIApplication sharedApplication].keyWindow.rootViewController.prefersStatusBarHidden;
}
@end
If that fixes your problem, please let me know so I can create a pull request to get it in soon :)
@rodrigoelp nope didn't work. Appears that prefersStatusBarHidden
and preferredStatusBarStyle
only get called once ever on COSTouchOverlayWindowViewController
.
I wonder how we can tell it that it needs to reload the status bar style.
For this reason I wonder if the double UIWindow approach is the best. I just fired up ASTouchVisualizer and it works correctly with status bars out of the box. They swizzle [UIWindow sendEvent:]
so no UIWindows need to be replaced.
COSTouchVisualizer is prettier though. Also, middle-school me keeps giggling every time I say ASTouch.
What's the reasoning for using UIWindow
for overlayWindowViewController
? Couldn't you just add overlayWindowViewController.view
as a subview of UIWindow
and bring it to the front?
@johnboiles I got this code from an early version of https://github.com/mapbox/Fingertips/. If having an view at the top of the view hierarchy is better, I'm cool with changing it.
Going though their history, it looks like they have already solved this problem here: https://github.com/mapbox/Fingertips/commit/68ac00dee1d8e456b7cde5fab979ebc8f443c1a3
I'll take a look at the diff's and try and fix it in a few hours.
This is fixed in 393debeb77d1e87fc036df3ec42969d2fe3a57b1
Yep! Can confirm it's fixed in 393debe thanks Joe!
Operations related statusbar like "hide/show statusbar" and "content color" are not work correctly.