UIImagePickerController versus iOS8 status bar

I am subclassing UIImagePickerController

in an attempt to override the default status bar behavior and have mixed results. My app uses a controller based status bar appearance.


Without subclassing, I found that it changes the style of the status bar to Default

(dark) when the collector is fired, and nothing I've tried so far in my initial view controller fixes it. Also, when the collector hides the status bar during its presentation by sliding it up, the starting controller's navigation bar displays it from a height of 64 to 44.

So, I want my subclass to UIImagePickerController

keep the status bar style like LightContent

and when trying to get around the sliding navbar, hold the status bar while showing the presentation, then hide it on viewDidAppear:

.

The first interesting thing is that preferredStatusBarStyle

, and prefersStatusBarHidden

in my subclass of selection is not called until I turned over childViewControllerForStatusBarStyle

and childViewControllerForStatusBarHidden

to return nil. This seems to indicate that it usually UIImagePickerController

overrides them, perhaps to return an internal child view controller. If you look at the hierarchy of views in viewDidAppear:

, then there is definitely a child PLImagePickerCameraView

, and most likely there will be a controller. Unfortunately, we cannot override this controller.

By overriding those methods childViewControllerFor...

, preferredStatusBarStyle

and prefersStatusBarHidden

, are called between viewWillAppear:

and viewDidAppear:

and can actually see the status bar and LightContent

. However, the second interesting thing is that the presentViewController

status bar flashes briefly before animation . No additional calls to setNeedsStatusBarAppearanceUpdate

in viewWillAppear:

or other places such as viewDidLoad:

seem to have failed.

The third interesting thing is that during firing, the stroke style still gets dark and no additional calls setNeedsStatusBarAppearanceUpdate

in the picker viewWillDisappear:

or viewDidDisappear:

seem to allow it.

tl; dr . I found that overriding UIImagePickerController

to hide and show the status bar on demand works very well, but customizing the panel style is problematic. Something in the picker class or UINavigationController

itself automatically prefers the style of the styles Default

, and when it switches to it on firing it seems hard to get it back.

I've seen the question UIImagePickerController breaks the appearance of the status bar and nothing I've seen there has helped yet, and iOS8.1 doesn't fix it. I was pretty sure setting the picker navigationBar.barStyle

to black would do it, but not dice. Anyone ideas?

(Any advice on preventing the navbar UINavigationController

from sliding to 44 height while the status bar is hidden thanks would also be helpful )

+1


source to share





All Articles