HBAppearanceSettings

@interface HBAppearanceSettings : NSObject

The HBAppearanceSettings class in CepheiPrefs provides a model object read by other components of Cephei to determine colors to use in the user interface.

Appearance settings are typically set on a view controller, via the -[PSListController(HBTintAdditions) hb_appearanceSettings] property. This is automatically managed by Cephei and provided to view controllers as they are pushed onto the stack.

This interface replaces the previous method that worked in the opposite way – HBListController would work backwards to find a view controller with appearance settings defined. This was not robust, created messy code within Cephei, and can cause a mix of colors if a view controller with different settings to the prior one is pushed.

Use of the old properties on HBListController will cause a warning to be logged.

Most commonly, the API will be used by setting the hb_appearanceSettings property from the init method. The following example sets the tint color, table view background color, and enables an inverted navigation bar:

- (instancetype)init {
    self = [super init];

    if (self) {
        HBAppearanceSettings *appearanceSettings = [[HBAppearanceSettings alloc] init];
        appearanceSettings.tintColor = [UIColor colorWithRed:66.f / 255.f green:105.f / 255.f blue:154.f / 255.f alpha:1];
        appearanceSettings.tableViewBackgroundColor = [UIColor colorWithWhite:242.f / 255.f alpha:1];
        appearanceSettings.invertedNavigationBar = YES;
        self.hb_appearanceSettings = appearanceSettings;
    }

    return self;
}

General

  • The tint color to use for interactable elements within the list controller. Set this property to a UIColor to use.

    A nil value will cause no modification of the tint to occur.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *tintColor;

    Swift

    @NSCopying var tintColor: UIColor? { get set }

    Return Value

    By default, nil.

  • The user interface style to use. Set this property to a UIUserInterfaceStyle to use.

    Declaration

    Objective-C

    @property (nonatomic) UIUserInterfaceStyle userInterfaceStyle;

    Swift

    var userInterfaceStyle: UIUserInterfaceStyle { get set }

    Return Value

    By default, UIUserInterfaceStyleUnspecified.

Navigation Bar

  • The tint color to use for the navigation bar buttons, or, if invertedNavigationBar is set, the background of the navigation bar. Set this property to a UIColor to use, if you don’t want to use the same color as tintColor.

    A nil value will cause no modification of the navigation bar tint to occur.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *navigationBarTintColor;

    Swift

    @NSCopying var navigationBarTintColor: UIColor? { get set }

    Return Value

    By default, nil.

  • The color to use for the navigation bar title label. Set this property to a UIColor to use.

    A nil value will cause no modification of the navigation bar title color to occur.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *navigationBarTitleColor;

    Swift

    @NSCopying var navigationBarTitleColor: UIColor? { get set }

    Return Value

    By default, nil.

  • The background color to use for the navigation bar. Set this property to a UIColor to use.

    A nil value will cause no modification of the navigation bar background to occur.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *navigationBarBackgroundColor;

    Swift

    @NSCopying var navigationBarBackgroundColor: UIColor? { get set }

    Return Value

    By default, nil.

  • The status bar style to use. Set this property to a UIStatusBarStyle to use.

    Declaration

    Objective-C

    @property (nonatomic) UIStatusBarStyle statusBarStyle;

    Swift

    var statusBarStyle: UIStatusBarStyle { get set }

    Return Value

    By default, UIStatusBarStyleDefault.

  • Deprecated

    Set statusBarStyle instead.

    The color to use for the status bar icons. Set this property to a UIColor to use.

    A nil value will cause no modification of the status bar color to occur.

    Warning

    Setting the status bar to a custom color is no longer possible as of iOS 13. Set statusBarStyle instead.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *statusBarTintColor;

    Swift

    @NSCopying var statusBarTintColor: UIColor? { get set }

    Return Value

    By default, nil.

  • Deprecated

    Set navigationBarBackgroundColor and navigationBarTitleColor instead.

    Whether to use an inverted navigation bar.

    An inverted navigation bar has a tinted background, rather than the buttons being tinted. All other interface elements will be tinted the same.

    Declaration

    Objective-C

    @property (nonatomic) BOOL invertedNavigationBar;

    Swift

    var invertedNavigationBar: Bool { get set }

    Return Value

    By default, NO.

  • Whether to use a translucent navigation bar. Set this property to YES if you want this behavior.

    Declaration

    Objective-C

    @property (nonatomic) BOOL translucentNavigationBar;

    Swift

    var translucentNavigationBar: Bool { get set }

    Return Value

    By default, YES.

  • Whether to use a large title on iOS 11 and newer. Set this property to a value from HBAppearanceSettingsLargeTitleStyle.

    Declaration

    Objective-C

    @property (nonatomic) HBAppearanceSettingsLargeTitleStyle largeTitleStyle;

    Swift

    var largeTitleStyle: HBAppearanceSettingsLargeTitleStyle { get set }

    Return Value

    By default, HBAppearanceSettingsLargeTitleStyleRootOnly.

Table View

  • The color to be used for the overall background of the table view. Set this property to a UIColor to use.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *tableViewBackgroundColor;

    Swift

    @NSCopying var tableViewBackgroundColor: UIColor? { get set }

    Return Value

    By default, nil.

  • The color to be used for the text color of table view cells. Set this property to a UIColor to use.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *tableViewCellTextColor;

    Swift

    @NSCopying var tableViewCellTextColor: UIColor? { get set }

    Return Value

    By default, nil.

  • The color to be used for the background color of table view cells. Set this property to a UIColor to use.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *tableViewCellBackgroundColor;

    Swift

    @NSCopying var tableViewCellBackgroundColor: UIColor? { get set }

    Return Value

    By default, nil.

  • The color to be used for the separator between table view cells. Set this property to a UIColor to use.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *tableViewCellSeparatorColor;

    Swift

    @NSCopying var tableViewCellSeparatorColor: UIColor? { get set }

    Return Value

    By default, nil.

  • The color to be used when a table view cell is selected. This color will be shown when the cell is in the highlighted state.

    Set this property to a UIColor to use.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIColor *tableViewCellSelectionColor;

    Swift

    @NSCopying var tableViewCellSelectionColor: UIColor? { get set }

    Return Value

    By default, nil.