Each head unit manufacturer supports a set of user interface templates. These templates determine the position and size of the text, images, and buttons on the screen. Once the app has connected successfully with an SDL enabled head unit, a list of supported templates is available on SDLManager.systemCapabilityManager.defaultMainWindowCapability.templatesAvailable
.
To change a template at any time, use [SDLScreenManager changeLayout:]
. This guide requires SDL iOS version 7.0. If using an older version, use the SetDisplayLayout
RPC.
When changing the layout, you may get an error or failure if the update is "superseded." This isn't technically a failure, because changing the layout has not yet been attempted. The layout or batched operation was cancelled before it could be completed because another operation was requested. The layout change will then be inserted into the future operation and completed then.
[self.sdlManager.screenManager changeLayout:[[SDLTemplateConfiguration alloc] initWithTemplate:SDLPredefinedLayoutGraphicWithText] withCompletionHandler:^(NSError * _Nullable error) { if (error != nil) { // Print out the error if there is one and return early return; } // The template has been set successfully }];
sdlManager.screenManager.changeLayout(SDLTemplateConfiguration(predefinedLayout: .graphicWithText)) { err in if let error = err { // Print out the error if there is one and return early return } // The template has been set successfully }
Template changes can also be batched with text and graphics updates:
[self.sdlManager.screenManager beginUpdates]; self.sdlManager.screenManager.textField1 = "Line of Text"; [self.sdlManager.screenManager changeLayout:[[SDLTemplateConfiguration alloc] initWithTemplate:SDLPredefinedLayoutGraphicWithText] withCompletionHandler:^(NSError * _Nullable error) { // This listener will be ignored, and will use the handler sent in endUpdatesWithCompletionHandler. }]; self.sdlManager.screenManager.primaryGraphic = <#SDLArtwork#>; [self.sdlManager.screenManager endUpdatesWithCompletionHandler:^(NSError * _Nullable error) { if (error != nil) { // Print out the error if there is one and return early return } // The data and template has been set successfully }];
sdlManager.screenManager.beginUpdates() sdlManager.screenManager.textField1 = "Line of Text" sdlManager.screenManager.changeLayout(SDLTemplateConfiguration(predefinedLayout: .graphicWithText)) { err in // This listener will be ignored, and will use the handler set in the endUpdates call. } sdlManager.screenManager.primaryGraphic = <#SDLArtwork#> sdlManager.screenManager.endUpdates { err in if let error = err { // Print out the error if there is one and return early return } // The data and template has been set successfully }
There are fifteen standard templates to choose from, however some head units may only support a subset of these templates. The following examples show how templates will appear on the Generic HMI and Ford's SYNC® 3 HMI.