Skip to content

Fix CarPlay map button icons on iOS 26+ - #5705

Open
aleksandr-tata wants to merge 7 commits into
masterfrom
task_5662_car_play_buttons_ios_26
Open

Fix CarPlay map button icons on iOS 26+#5705
aleksandr-tata wants to merge 7 commits into
masterfrom
task_5662_car_play_buttons_ios_26

Conversation

@aleksandr-tata

Copy link
Copy Markdown
Contributor

Summary

  • Use the glyph-only ic_custom_* assets for CPMapButton controls on iOS 26 and later.
  • Keep the existing composite btn_map_* assets unchanged on iOS 18 and earlier.
  • Update both image and focusedImage for rotary-controller focus.
  • Preserve the existing 2D/3D icon selection based on the current map mode.
  • Reuse the assets provided in the task without adding CarPlay-specific duplicates.

@aleksandr-tata
aleksandr-tata requested a review from tigrim August 28, 2026 10:01
@aleksandr-tata aleksandr-tata linked an issue Aug 28, 2026 that may be closed by this pull request
11 tasks
destinationSubtitle = nil;
}

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 260400

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xcode 26.2 Fix

}
}
mapButton.image = image;
mapButton.focusedImage = image;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, *))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button creation logic is also unclear


_3DModeMapButton = [self createMapButton:EOACarPlayButtonType3D];
BOOL is3DMode = [OAMapViewTrackingUtilities.instance is3DMode];
_lastIs3DMode = is3DMode;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update CPMapButton CarPlay

2 participants