Fix CarPlay map button icons on iOS 26+ - #5705
Conversation
| destinationSubtitle = nil; | ||
| } | ||
|
|
||
| #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 260400 |
There was a problem hiding this comment.
Xcode 26.2 Fix
| } | ||
| } | ||
| mapButton.image = image; | ||
| mapButton.focusedImage = image; |
There was a problem hiding this comment.
Do we need to set focusedImage explicitly here? According to CPMapButton documentation, when focusedImage is nil, CarPlay automatically creates the focused appearance from image. Using the same image for both may prevent the standard focus effect
| [directionsGrid present]; | ||
| } | ||
|
|
||
| - (void)updateMapButton:(CPMapButton *)mapButton |
There was a problem hiding this comment.
Could we move this into a common image helper and pass whether the image should use template rendering? This would avoid having separate [UIImage templateImageNamed:] and [UIImage imageNamed:] branches here.
+ (UIImage *)imageNamed:(NSString *)imageName template:(BOOL)template
{
return template
? [UIImage templateImageNamed:imageName]
: [UIImage imageNamed:imageName];
}
| if ([mapViewTrackingUtilities is3DMode]) | ||
| || (map3DMode == Map3DModeVisibilityVisibleIn3DMode && !is3DMode); | ||
| BOOL shouldRecreateButton = NO; | ||
| if (@available(iOS 26.0, *)) |
There was a problem hiding this comment.
The button creation logic is also unclear
|
|
||
| _3DModeMapButton = [self createMapButton:EOACarPlayButtonType3D]; | ||
| BOOL is3DMode = [OAMapViewTrackingUtilities.instance is3DMode]; | ||
| _lastIs3DMode = is3DMode; |
There was a problem hiding this comment.
Why do we need to store is3DMode in _lastIs3DMode here? How will it behave if the 2D/3D mode is changed from the phone while CarPlay is connected?
| NSMutableArray<CPMapButton *> *mapButtons = _mapTemplate.mapButtons.mutableCopy; | ||
| mapButtons[buttonIndex] = mapButton; | ||
| _mapModeButton = mapButton; | ||
| _mapTemplate.mapButtons = mapButtons; |
There was a problem hiding this comment.
Why do we need to recreate CPMapButton on iOS 26 when switching between 2D and 3D? If this is required because CarPlay caches the automatically generated focused image, could we document that workaround here? Otherwise, updating the existing button’s image would avoid replacing the entire mapButtons array
Summary
ic_custom_*assets forCPMapButtoncontrols on iOS 26 and later.btn_map_*assets unchanged on iOS 18 and earlier.imageandfocusedImagefor rotary-controller focus.