UINavigationController does not implement -childViewControllerForStatusBarStyle
| Originator: | danielrhammond | ||
| Number: | rdar://15182487 | Date Originated: | 10/8/2013 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 7.0.2 |
| Classification: | Reproducible: | Always |
Summary: The UINavigationController does not implement childViewControllerForStatusBarStyle to return the topmost view controller in its stack. When using "View controller-based status bar appearance" with a UINavigationController none of the UINavigationController's viewControllers will get the -preferredStatusBarStyle method called. This renders the view controller based status bar appearance pretty useless when using a UINavigationController, and can be fixed by subclassing UINavigationController or creating a custom container view controller but this is an annoyance and does not seem like it should be necessary just to get the preference to be observed. Steps to Reproduce: 1. Create a new iOS project with the empty template in Xcode 2. Set UIViewControllerBasedStatusBarAppearance to YES in the applications' info.plist 3. Create a UIViewController subclass with an implementation for -preferredStatusBarStyle 4. In the app delegate create a UINavigationController with the UIViewController subclass as its rootViewController 5. Set the window's rootViewController to that UINavigationController Expected Results: preferredStatusBarStyle would be called on the UIViewController subclass and the status bar style would be updated to whatever the style returned in that method Actual Results: preferredStatusBarStyle is never called on the UIViewController that is set as the rootViewController of the UINavigationController. Calling setNeedsStatusBarAppearanceUpdate also has no effect. Version: 7.0.2 Notes: Creating a subclass of the UINavigationController and returning self.topViewController in childViewControllerForStatusBarStyle and childViewControllerForStatusBarHidden fixes this problem. Sample Code: https://github.com/danielrhammond/Preferred-Status-Bar-Style-Navigation-Controller-Experiment Workaround: https://gist.github.com/danielrhammond/6894539
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!