Customize User Interfaces (Optional)
Overview
As most UI configurations are primarily made from the OneTrust tenant, this section is optional. If your app has a use case where it needs to make additional configurations (e.g. font family) otherwise not available to be configured in the tenant or if it needs to control the UI configurations locally, you can use this custom configuration functionality.
UI elements are configured through a plist supplied by OneTrust. See the Sample App for a demo.
Import the Custom UI Property List
- Download the Sample App from your tenant. Steps here.
- After unzipping the file:
- Access the OTPublishersHeadlessSDK-XCFramework
- Select your corresponding file (if tvOS, select OTPublishersHeadlessSDKtvOS. If iOS, select the other one)
- Select OTPublishersHeadlessSDK.xcframework > ios-arm64
- OTPublishersHeadlessSDK.framework > OTSDK-UIConfig-iOS.plist
tvOS will follow the same steps but with tvos file labels.
- Copy the plist file into your app. Select 'Copy items if needed' to ensure the plist is added to the application folder hierarchy.
- Edit the UI elements in the plist as necessary.

Do not add any rows or change the keys itself in the plist. Only change the values of existing properties.
Styles set in the plist will be given priority over server values when rendering the UI if the custom config property is set.
Configure the SDK
- As part of the
UIConfigurator
protocol, setshouldUseCustomUIConfig()
totrue
. - As part of the
UIConfigurator
protocol, conform tocustomUIConfigFilePath()
.- While conforming to this method, provide the path to the plist.
//iOS and tvOS
//Conform to this in order to customize the UI locally
OTPublishersHeadlessSDK.shared.uiConfigurator = self
extension AppDelegate: UIConfigurator {
func shouldUseCustomUIConfig() -> Bool {
return true
}
func customUIConfigFilePath() -> String? {
//path to plist file
let customPath = Bundle.main.path(forResource: "OTSDK-UIConfig-iOS", ofType: "plist")
return customPath
}
}
Customizing the UI
This section describes the UI elements that can be configured.
Table of contents:
- Customizing the Navigation Bar
- Customizing the Banner View
- Customizing the Preference Center View
- Customizing the Purpose Details View
- Customizing the Vendor List View [for IAB TCF Customers]
- Customizing the Vendor Details View [for IAB TCF Customers]
- Customizing the SDK List View
- Customize CNIL Button
- Custom Fonts
Customizing Page Headers (Navigation Bar)
All page header related customizations are listed underpageHeader
in the plist. This is a common theme that will be applied to all the SDK view navigation bars.
The following are the customizations available:
UI Element | Key Name | Type | Description |
---|---|---|---|
Text Color | textColor | String | Hex code. Styles the color of the text |
Font Name | fontName | String | Styles the font of the text |
Tint Color | tintColor | String | Hex code. Styles the tint color of the page header/nav bar |
Background Color | backgroundColor | String | Hex code. Styles the background color of the page header/nav bar |
Font Text Style | fontTextStyle | String | Styles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below |
Font Size | fontSize | Int | Styles the size of the font |
Font Text Style Options |
---|
largeTitle |
title1 |
title2 |
title3 |
headline |
subheadline |
body |
callout |
footnote |
caption1 |
caption2 |
Note
- When a custom
fontName
is provided, at least one of thefontSize
orfontTextStyle
should also be provided in order for it to reflect.- In order for dynamic font sizes to be supported, the application will have to provide a valid value for
fontTextStyle
if customizing the fonts.
Customizing the Banner UI
All banner view related customizations are listed under bannerTheme
in the plist.
The following are the customizations available for the Banner View:
UI Element | Key Name | Type | Description |
---|---|---|---|
Links | policyLink vendorList | Dictionary | Styles the Privacy Policy or Vendors List link |
Background Color | backgroundColor | String | Styles the background color of the banner view |
Buttons | closeButton acceptAll rejectAll showPreferences | Dictionary | Styles the close ('x'), accept all, reject all, and manage settings CTAs |
Summary | title description | Dictionary | Styles the title and description text of the banner view |
Here's a list of possible UI styles to be changed under each applicable element above:
UI Element | Key Name | Type | Description |
---|---|---|---|
Text Color | textColor | String | Hex code. Styles the color of the text |
Font Name | fontName | String | Styles the font of the text |
Tint Color | tintColor | String | Hex code. Styles the tint color of the page header/nav bar |
Background Color | backgroundColor | String | Hex code. Styles the background color of the page header/nav bar |
Font Text Style | fontTextStyle | String | Styles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below |
Font Size | fontSize | Int | Styles the size of the font |
Font Text Style Options |
---|
largeTitle |
title1 |
title2 |
title3 |
headline |
subheadline |
body |
callout |
footnote |
caption1 |
caption2 |
Note
- When a custom
fontName
is provided, at least one of thefontSize
orfontTextStyle
should also be provided in order for it to reflect.- In order for dynamic font sizes to be supported, the application will have to provide a valid value for
fontTextStyle
if customizing the fonts.
Customizing the Preference Center UI
All preference center view related customizations are listed under preferenceCenterTheme
in the plist.
The following customizations are available for the Preference Center View:
UI Element | Key Name | Type | Description |
---|---|---|---|
Purpose Title | purposeTitle | Dictionary | Styles the text of the OneTrust categories/IAB purposes |
Buttons | acceptAll rejectAll confirmMyChoice closeButton | Dictionary | Styles the accept, reject, close, and confirm choices CTAs |
Show Logo on PC | showLogoOnPC | Boolean | Display/not display a logo |
Summary | title description | Dictionary | Styles the text of the title and description |
Toggle Color | toggleColor | String | Hex code. Styles the toggle color when toggled ON |
Links | policyLink vendorList | Dictionary | Styles the Privacy Policy or Vendor List link |
Right Chevron Color | rightChevronColor | String | Hex code. Styles the color of the chevron or 'arrow' to the right of each category/purpose |
Line Break Color | lineBreakColor | String | Hex code. Styles the lines separating each category/purpose (if enabled) |
Background Color | backgroundColor | String | Hex code. Styles the background color of the preference center view |
Purposes Always Active Status | purposesAlwaysActiveStatus | Dictionary | Styles the always active text of the strictly necessary categories |
Here's a list of possible UI styles to be changed under each applicable element above:
UI Element | Key Name | Type | Description |
---|---|---|---|
Text Color | textColor | String | Hex code. Styles the color of the text |
Font Name | fontName | String | Styles the font of the text |
Tint Color | tintColor | String | Hex code. Styles the tint color of the page header/nav bar |
Background Color | backgroundColor | String | Hex code. Styles the background color of the page header/nav bar |
Font Text Style | fontTextStyle | String | Styles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below |
Font Size | fontSize | Int | Styles the size of the font |
Font Text Style Options |
---|
largeTitle |
title1 |
title2 |
title3 |
headline |
subheadline |
body |
callout |
footnote |
caption1 |
caption2 |
Note
- When a custom
fontName
is provided, at least one of thefontSize
orfontTextStyle
should also be provided in order for it to reflect.- In order for dynamic font sizes to be supported, the application will have to provide a valid value for
fontTextStyle
if customizing the fonts.
Customizing the Purposes Details UI
The consumer application has to edit the OTSDK-UIConfig.plist file in order to customize the UI. All the purpose details view related customization would be present under the purposeDetailsTheme
dictionary in the plist.
The following color options are customizations available for the Purposes Details View:
- backgroundColor (String) - A hex string representing the background color of the purposes details view
- (ex: #FFFFFF)
- lineBreakColor (String) - A hex string representing the separator lines color
- (ex: #FFFFFF)
- toggleColor (String) - A hex string representing the switch color when toggled On
- (ex: #FFFFFF)
The following UI Elements are the customizations available for the Purposes Details View:
UI Element | Key Name | Applied To | Default Value |
---|---|---|---|
Group Summary | title description | Purpose Details Title Purpose Details Description | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Consent Title | consentTitle | Consent Title | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Legitimate Interest | legitInterestTitle | Legit Interest Title | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Purposes Always Active Status | alwaysActiveStatus | Always Active Status text | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Links | sdkList vendorList fullLegalText | SDK Lists link Vendor Lists link Full Legal Text link | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Customizing the Vendor List UI
The consumer application has to edit the OTSDK-UIConfig.plist file in order to customize the UI. All the vendor list view related customization would be present under the vendorListTheme
dictionary in the plist.
The following color options are customizations available for the Vendor List View:
- backgroundColor (String) - A hex string representing the background color of the vendor list
- (ex: #FFFFFF)
- lineBreakColor (String) - A hex string representing the separator lines color
- (ex: #FFFFFF)
- toggleColor (String) - A hex string representing the switch color when toggled ON
- (ex: #FFFFFF)
- filterOnColor (String) - A hex string representing the filter icon color when filter is applied
- (ex: #FFFFFF)
- filterOffColor (String) - A hex string representing the switch color when no filter is applied
- (ex: #FFFFFF)
- filterSelectionColor (String) - A hex string representing the tint color of the check mark in the vendor filter list
- (ex: #FFFFFF)
The following UI Elements are the customizations available for the Vendor List View:
UI Element | Key Name | Applied To | Default Value |
---|---|---|---|
Vendor List Navigation | filterNavText | Vendor Filter Navigation Bar text(s) | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Vendor Item | title | Vendor Item | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Filter Item | filterItemTitle | Filter Item | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Buttons | confirmMyChoices applyFilter | Confirm My Choices button Apply Filter button | backgroundColor (String) fontName (String) fontSize (Int) fontTextStyle (String) textColor (String) borderColor (String) borderRadius (Int) borderWidth (Int) |
Search Bar | searchBar | Vendor List Search Bar | textColor(String) placeholderTextColor(String) backgroundColor(String) iconColor(String) borderColor(String) borderWidth(Int) borderRadius(Int) |
Customizing the Vendor Details UI
The consumer application has to edit the OTSDK-UIConfig.plist file in order to customize the UI. All the vendor details view related customization would be present under the vendorDetailsTheme
dictionary in the plist.
The following color options are customizations available for the Vendor Details View:
- backgroundColor (String) - A hex string representing the background color of the vendor details view
- (ex: #FFFFFF)
- toggleColor (String) - A hex string representing the switch color when toggled ON
- (ex: #FFFFFF)
The following UI Elements are the customizations available for the Vendor Details View:
UI Element | Key Name | Applied To | Default Value |
---|---|---|---|
Title | title | Vendor Details Title | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Details Summary | title description | Vendor Details Description Title Vendor Details Description | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Consent Title | consentTitle | Consent Title | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Legitimate Interest | legitInterestTitle | Legit Interest Title | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Links | privacyNotice | Privacy Notice link | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Customizing the SDK List UI
The consumer application has to edit the OTSDK-UIConfig.plist file in order to customize the UI. All the SDK list view related customization would be present under the sdkListTheme
dictionary in the plist.
The following color options are customizations available for the SDK List View:
- backgroundColor (String) - A hex string representing the background color of the SDK list
- (ex: #FFFFFF)
- lineBreakColor (String) - A hex string representing the separator lines color
- (ex: #FFFFFF)
- filterOnColor (String) - A hex string representing the filter icon color when filter is applied
- (ex: #FFFFFF)
- filterOffColor (String) - A hex string representing the switch color when no filter is applied
- (ex: #FFFFFF)
The following UI Elements are the customizations available for the SDK List View:
UI Element | Key Name | Applied To | Default Value |
---|---|---|---|
Summary | title description | SDK Item Title SDK Item Description | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Check Mark Filter Selection | filterSeletionColor | Check Mark tint color | selectionColor (String) |
SDK Filter List Navigation Bar | filterNavText | SDK Filter List Navigation Bar text(s) | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
SDK Filter Item | sdkItem | Filter Item | fontName (String) fontSize (Int) fontTextStyle (String) textAlignment (String) textColor (String) |
Buttons | applyFilter | Apply Filter button | backgroundColor (String) fontName (String) fontSize (Int) fontTextStyle (String) textColor (String) borderColor (String) borderRadius (Int) borderWidth (Int) |
Search Bar | searchBar | SDK List Search Bar | textColor(String) placeholderTextColor(String) backgroundColor(String) iconColor(String) borderColor(String) borderWidth(Int) borderRadius(Int) |
Customizing 'Display CNIL as Button'
With OneTrust 6.22.0, mobile app customers can now customize the Continue Without Accepting link as a button to promote a consistent experience when presented with a close option. For more information on the app-side configuration of mobile templates to display as text or link, see CNIL Mobile App Requirements on the myOneTrust Knowledge Base.
UIConfigurator
- Return True
UIConfigurator
- Return True- Open the
AppDelegate.swift
file. - Locate the
shouldUseCustomUIConfig() -> Bool
function. - Update the value as
return true
. It will be set toreturn false
by default.
extension AppDelegate: UIConfigurator {
func shouldUseCustomUIConfig() -> Bool {
return true
}
Customize closeButton
closeButton
- Open the
OTSDK-UIConfig-iOS.plist
file. - Locate
Root > bannerTheme > buttons > closeButton
. - The parameters for
closeButton
will be blank by default. Provide your customizations for the Continue Without Accepting button.
Key Name | Type |
---|---|
backgroundColor | String |
fontName | String |
fontSize | Number |
fontTextStyle | String |
textColor | String |
borderColor | String |
borderWidth | Number |
borderRadius | Number |
Custom Fonts
The Native SDK can support a Font Name override to support custom fonts.
- Add custom fonts to Xcode: Apple documentation
- Reference the fonts in the SDK plist. Ensure you specify a font size in the plist for the custom font to take effect.
Updated 1 day ago