0

In the carplay app is only one page, with a list of radio stations. If you tap one, the "now playing" screen shows up: root page

In the "Now playing" screen I want to change the button text of the back button (upper left), and the text of the App Name (upper right).
Also I want to hide the "1/1". This is new in iOS 14, but find no property for this. enter image description here

Suplanus
  • 1,523
  • 16
  • 30

1 Answers1

1

According to the documentation for CPNowPlayingTemplate, the information used to populate the view comes from the MPNowPlayingSession and MPNowPlayingInfoCenter objects.

I do note this important line from the MPNowPlayingInfoCenter documentation:

You do not have direct control over which information is displayed, or its formatting. You set the values of the now playing info center dictionary according to the information you want to provide to the system. The system, or the connected accessory, handles the information’s display in a consistent manner for all apps.


The "1/1" / "1 von 1" / "1 of 1" value is specified with two keys:

I believe the top-left Back button is hardcoded to always by your app's display-name, but I might be wrong.

Dai
  • 141,631
  • 28
  • 261
  • 374
  • Great answer. Thanks. But I saw apps which have no "1/1", how to hide this? Set it to `null`? The back button is the app name if navigated from root page, or its the page title when navigated from sub page. – Suplanus Aug 21 '20 at 05:52
  • @Suplanus The dictionary value for `MPNowPlayingInfoPropertyPlaybackQueueIndex` is an `NSUInteger` (aka `unsigned long`), which cannot be null. I might suggest using a value of zero or `-1` (negative-1) or removing both keys from the dictionary entirely and seeing what happens. I have zero experience working with CarPlay and I haven't used Swift or Apple's SDKs in 4+ years now :) – Dai Aug 21 '20 at 05:58
  • Can you tell me what should i do to display a now playing icon on the first image, I have spent more time recently to display it but still can't. – Le Minh Dec 08 '20 at 09:08