首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用CPNowPlayingImageButton时,CarPlay NowPlaying屏幕在深色外观上显示错误图像

使用CPNowPlayingImageButton时,CarPlay NowPlaying屏幕在深色外观上显示错误图像
EN

Stack Overflow用户
提问于 2021-10-23 01:47:18
回答 1查看 129关注 0票数 0

我正在使用CarPlay框架开发CarPlay应用程序。

我使用CPNowPlayingImageButton在NowPlaying模板上显示自定义按钮。

https://developer.apple.com/documentation/carplay/cpnowplayingimagebutton?language=objc

创建了ImageAsset镜像,

然后创建CPNowPlayingImageButton。

代码语言:javascript
复制
UIImage* image = [UIImage imageNamed:@"carplay_heart" inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:self.interfaceController.carTraitCollection];

CPNowPlayingImageButton* button = [CPNowPlayingImageButton.alloc initWithImage:image handler:^(CPNowPlayingImageButton*)
{
    JPlaylistUtils::CurrentToggleFavorite(FALSE, TRUE, nil);
}];

[CPNowPlayingTemplate.sharedTemplate updateNowPlayingButtons:@[button]];

我期望在浅色外观上显示黑色图像,在深色外观上显示白色图像,但CarPlay在深色外观上显示的总是黑色(浅色主题)图像,并且图像尺寸太小。

如果我在CarPlay /设置中更改了外观,第一次显示的图像就像预期的那样。

但是如果更新按钮,CarPlay会再次显示错误的图像。

EN

回答 1

Stack Overflow用户

发布于 2021-10-26 16:44:40

我建议您只使用一个图像,并让CarPlay通过设置渲染为模板图像来计算明/暗模式着色。你的图片有哪些尺寸?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69684507

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档