tintColor is ignored in view controller within UINavigationController presented modally in 7.1
| Originator: | adam | ||
| Number: | rdar://17023071 | Date Originated: | 23-May-2014 05:22 PM |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | 7.1 |
| Classification: | UI/Usability | Reproducible: | Yes |
Summary: I have set a custom tintColor in my application's window, and I set a different tintColor in a view controller that I present modally as a form sheet. I have found that in iOS 7.1 my modal view controller is ignoring its tintColor in favor of the tintColor in the window. This only seems to reproduce if the following conditions are met: 1. The view control is inside a UINavigationController. 2. The navigation controller's modalPresentationStyle is set to UIModalPresentationFormSheet or UIModalPresentationPageSheet. 3. The navigation controller is presented using presentViewController:animate:completion: 4. Your app is running in iOS 7.1 (running the app in iOS 7.0 has the expected behavior). Steps to Reproduce: 1. Open and run the attached Xcode project in iOS 7.1. 2. Notice that all of the controls have the same color. 3. Press the button in the center of the screen. A modal form sheet appears using the same view controller class. Notice that in this modal version the controls are not all the same color. Expected Results: All controls in the first screen should be purple. All controls in the second screen should be green. Actual Results: In the modal screen the button and segmented control are purple (the app window's tintColor) instead of green (the tintColor of the view controller's view). Version: iOS 7.1.1 Notes: The only workaround I have found for this issue is to temporarily set the tintColor to clearColor and then back in viewWillLayoutSubviews. Doing the same thing in viewWillAppear does not work, and in viewDidAppear it is too late because the original (wrong) color will show up briefly before it is fixed.
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!
Simpler workaround
The workaround can be slightly simplified: You only need to set the tintColor to its correct value in viewWillLayoutSubviews. You do not need to set the tintColor to clearColor first.