diff --git a/HMSegmentedControl/HMSegmentedControl.m b/HMSegmentedControl/HMSegmentedControl.m index 51e26e4e..26a4bfc7 100755 --- a/HMSegmentedControl/HMSegmentedControl.m +++ b/HMSegmentedControl/HMSegmentedControl.m @@ -279,7 +279,12 @@ - (NSAttributedString *)attributedTitleAtIndex:(NSUInteger)index { // the color should be cast to CGColor in order to avoid invalid context on iOS7 UIColor *titleColor = titleAttrs[NSForegroundColorAttributeName]; - + + // Core Animation objects (in this case, CATextLayer) won't reflect a change in the current trait collection. So we need to resolve explicitly. + if (@available(iOS 13.0, *)) { + titleColor = [titleColor resolvedColorWithTraitCollection: UITraitCollection.currentTraitCollection]; + } + if (titleColor) { NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:titleAttrs];