Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change UIStatusBarStyle in iOS 7 in modal views with navigation bar?
    primarykey
    data
    text
    <p>The <a href="https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/AppearanceCustomization.html#//apple_ref/doc/uid/TP40013174-CH15-SW1">iOS 7 Transition Guide</a> give a good hint how to change the <code>UIStatusBarStyle</code> dynamically in a <code>UIViewController</code> using </p> <pre><code>- (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleDefault; } </code></pre> <p>together with <code>[self setNeedsStatusBarAppearanceUpdate];</code></p> <p>This works fine in a single view application. However, I'm now trying to change the <code>UIStatusBarStyle</code> in a modal view to <code>UIStatusBarStyleLightContent</code>. There is a <code>MainViewController</code> which segues to the <code>ModalViewController</code>, which itself is embedded in a <code>NavigationController</code>. The <code>ModalViewController</code> has set its delegate to the <code>MainViewController</code>. </p> <p>I tried to call <code>[self setNeedsStatusBarAppearanceUpdate];</code> in the <code>ModalViewController</code> together with the following method in that class without effect:</p> <pre><code>// In ModalViewController.m - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; } </code></pre> <p>I also tried to call <code>[self setNeedsStatusBarAppearanceUpdate];</code> in <code>MainViewController</code> on <code>prepareForSegue: sender:</code> method with conditions in <code>- (UIStatusBarStyle)preferredStatusBarStyle {}</code> to return <code>UIStatusBarStyleLightContent</code> when the modal view is presented - but that has no effects, too.</p> <p>How can I change the UIStatusBarStyle in the modal view?</p> <p><strong>EDIT:</strong> Post updated: I need to mention that the <code>ModalViewController</code> is embedded in a <code>NavigationController</code> with a <code>NavigationBar</code>. With <code>NavigationBar</code> set to hidden to above call of <code>[self setNeedsStatusBarAppearanceUpdate];</code> in <code>ModalViewController</code> works fine. But not when the Bar is visible.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload