Closed ShanMa1991 closed 2 years ago
I think that this is expected behavior. Appearance changes for certain trait collections now have precedence over global change, this means that appearance change you've posted in example will not have any effect. Instead, for iOS such styling should be used:
UILabel.appearance(for: UITraitCollection(userInterfaceIdiom: .phone), whenContainedInInstancesOf: [FeedbackViewController.self]).textColor = .red
I've also created this ticket in our examples repo to refresh legacy styling.
@MaximAlien Thanks for the information and the example, it works as expected.
hi @MaximAlien and @ShanMa1991, does it mean that the way for customzing style in this example is no longer valid?
When testing this example by setting different color to manuevers (e.g. LanesView.appearance().backgroundColor
, ManeuverView.appearance().backgroundColor
), the code doens't change the color. (testing on the phone simulator, not carplay)
@jinny-nam Yes, right now we may need to add UITraitCollection
to customize the style as in the comment. We'll update the Example repo for this issue. Thanks!
Hi @jinny-nam, https://github.com/mapbox/mapbox-navigation-ios/pull/4086 has been merged to provide a code snippet for custom styling. https://github.com/mapbox/mapbox-navigation-ios-examples/pull/188 will be merged to update the Example for Styled UI Elements. The major change is that now users need to add the UITraitCollection
for UIAppearance
when customize UI components for styling.
Mapbox Navigation SDK version
v2.6.0-rc.1
Steps to reproduce
Example
App, create a customMapboxNavigation.Style
as below.styleManager.styles = [DayStyle(), NightStyle()]
withstyleManager.styles = [DayStyle(), NightStyleSpy()]
inViewController.setupStyleManager()
Toggle Day/Night Style
FeedbackViewController
label.Expected behavior
The label is red in text color
Actual behavior
The label shows the default white color.
Is this a one-time issue or a repeatable issue?
repeatable