iOS Preference Center Customization
Custom iOS Preference Center guide.
Styling the Preference Center
The preference center’s look can be customized by creating a UAPreferenceCenterStyle instance, setting its style properties, and then setting the style property of the Preference Center instance to the customized style instance.
For instance, we may want to change the color of the navigation bar in order to match our app and set custom fonts for the title and table view sections and preferences. In the example below, we assume the app has access to the “Roboto” font, but any stock or custom font may be used.
Setting a Preference Center style
let style = PreferenceCenterStyle()
// Customize the style object
style.navigationBarColor = UIColor(red: 0.988, green: 0.694, blue: 0.106, alpha: 1)
style.titleColor = UIColor(red: 0.039, green: 0.341, blue: 0.490, alpha: 1)
style.tintColor = UIColor(red: 0.039, green: 0.341, blue: 0.490, alpha: 1)
style.titleFont = UIFont(name: "Roboto-Regular", size: 17.0)
style.sectionTextFont = UIFont(name: "Roboto-Bold", size: 14.0)
style.preferenceTextFont = UIFont(name: "Roboto-Light", size: 12.0)
// Set the style on the default Preference Center UI
PreferenceCenter.shared.style = style
UAPreferenceCenterStyle *style = [[UAPreferenceCenterStyle alloc] init];
// Customize the style object
style.navigationBarColor = [UIColor colorWithRed:0.988 green:0.694 blue:0.106 alpha:1];
style.titleColor = [UIColor colorWithRed:0.039 green:0.341 blue:0.490 alpha:1];
style.tintColor = [UIColor colorWithRed:0.039 green:0.341 blue:0.490 alpha:1];
style.titleFont = [UIFont fontWithName:@"Roboto-Regular" size:17.0];
style.sectionTextFont = [UIFont fontWithName:@"Roboto-Bold" size:13.0];
style.preferenceTextFont = [UIFont fontWithName:@"Roboto-Light" size:12.0];
// Set the style on the default Preference Center UI
[UAPreferenceCenter shared].style = style;
Feedback
Was this page helpful?
Thank you
Thanks for your feedback!
Tell Us MoreThank you
We will try harder!
Tell Us MoreCategories