CepheiPrefs — Cells

  • The HBDiscreteSliderTableCell class in CepheiPrefs is a subclass of the standard slider cell, which displays a vertical line at every whole number. Additionally, when dragging the slider, it jumps to these lines so the user’s preference will always be a whole number.

    It is no longer necessary to use this as of iOS 8.2, which has built in isSegmented and segmentCount parameters on PSSliderCell. This class is kept for backwards compatibility, and will use the built-in implementation on iOS 8.2 and newer.

    Requires iOS 7.0 or later. A normal slider is shown for older versions.

    Specifier Parameters

    All parameters specific to PSSliderCell are applicable here. There are no custom parameters.

    Example Usage

    <dict>
        <key>cell</key>
        <string>PSSliderCell</string>
        <key>cellClass</key>
        <string>HBDiscreteSliderTableCell</string>
        <key>default</key>
        <real>5</real>
        <key>defaults</key>
        <string>ws.hbang.common.demo</string>
        <key>key</key>
        <string>Discrete</string>
        <key>label</key>
        <string>Discrete</string>
        <key>max</key>
        <real>15</real>
        <key>min</key>
        <real>1</real>
    </dict>
    
    See more

    Declaration

    Objective-C

    @interface HBDiscreteSliderTableCell : PSControlTableCell

    Swift

    class HBDiscreteSliderTableCell : PSControlTableCell
  • The HBImageTableCell class in CepheiPrefs provides a simple way to display an image as a table cell, or a header or footer.

    Specifier Parameters

    icon Required. The file name of the image to display in the cell.

    If you use HBImageTableCell as a header or footer with headerCellClass or footerCellClass, it will size automatically to fit the image. If you use it as a cell with cellClass, you must set the height yourself using the height key.

    Example Usage

    <!-- As a header (or footer): -->
    <dict>
        <key>cell</key>
        <string>PSGroupCell</string>
        <key>headerCellClass</key>
        <string>HBImageTableCell</string>
        <key>height</key>
        <integer>100</integer>
        <key>icon</key>
        <string>logo.png</string>
    </dict>
    
    <!-- As a cell: -->
    <dict>
        <key>cellClass</key>
        <string>HBImageTableCell</string>
        <key>height</key>
        <integer>100</integer>
        <key>icon</key>
        <string>logo.png</string>
    </dict>
    

    Declaration

    Objective-C

    @interface HBImageTableCell : PSTableCell <PSHeaderFooterView>

    Swift

    class HBImageTableCell : PSTableCell, PSHeaderFooterView
  • The HBLinkTableCell class in CepheiPrefs displays a button that, when tapped, opens the specified URL. A typical icon can be used, or the initials key can be set to one or two characters to show as the icon.

    This cell can either be used without setting any cell type, or by setting it to PSButtonCell to get a tinted button.

    Specifier Parameters

    initials Optional. One or two characters to show as the icon.
    url Required. The URL to open.
    subtitle Optional. A subtitle to display below the label. The default is an empty string, hiding the subtitle.

    Example Usage

    <!-- With icon: -->
    <dict>
        <key>cellClass</key>
        <string>HBLinkTableCell</string>
        <key>icon</key>
        <string>example.png</string>
        <key>label</key>
        <string>Example</string>
        <key>url</key>
        <string>http://example.com/</string>
    </dict>
    
    <!-- With initials: -->
    <dict>
        <key>cellClass</key>
        <string>HBLinkTableCell</string>
        <key>initials</key>
        <string>XX</string>
        <key>label</key>
        <string>Example</string>
        <key>url</key>
        <string>http://example.com/</string>
    </dict>
    
    <!-- With a subtitle: -->
    <dict>
        <key>cellClass</key>
        <string>HBLinkTableCell</string>
        <key>label</key>
        <string>Example</string>
        <key>subtitle</key>
        <string>Visit our amazing website</string>
        <key>url</key>
        <string>http://example.com/</string>
    </dict>
    
    <!-- With a subtitle, in big mode: -->
    <dict>
        <key>big</key>
        <true/>
        <key>cellClass</key>
        <string>HBLinkTableCell</string>
        <key>height</key>
        <integer>64</integer>
        <key>label</key>
        <string>Example</string>
        <key>subtitle</key>
        <string>Visit our amazing website</string>
        <key>url</key>
        <string>http://example.com/</string>
    </dict>
    
    See more

    Declaration

    Objective-C

    @interface HBLinkTableCell : HBTintedTableCell

    Swift

    class HBLinkTableCell : HBTintedTableCell
  • The HBPackageTableCell class in CepheiPrefs provides a cell containing any package’s icon, name, and description. Tapping it opens the package in Cydia.

    Specifier Parameters

    packageIdentifier Required. The package identifier to retrieve the required information from.
    packageRepository Optional. The URL to the repository the package is available on, if not one of the default repos.
    label Required. The name of the package.
    subtitleText Optional. Can be used for a description of the package.

    Example Usage

    <!-- Typical: -->
    <dict>
        <key>cellClass</key>
        <string>HBPackageTableCell</string>
        <key>label</key>
        <string>Cephei</string>
        <key>packageIdentifier</key>
        <string>ws.hbang.common</string>
    </dict>
    
    <!-- With subtitle: -->
    <dict>
        <key>cellClass</key>
        <string>HBPackageTableCell</string>
        <key>label</key>
        <string>Cephei</string>
        <key>packageIdentifier</key>
        <string>ws.hbang.common</string>
        <key>subtitleText</key>
        <string>Support library for tweaks</string>
    </dict>
    
    <!-- From a repository: -->
    <dict>
        <key>cellClass</key>
        <string>HBPackageTableCell</string>
        <key>label</key>
        <string>Cephei</string>
        <key>packageIdentifier</key>
        <string>ws.hbang.common</string>
        <key>packageRepository</key>
        <string>https://cydia.hbang.ws</string>
    </dict>
    

    Declaration

    Objective-C

    @interface HBPackageTableCell : HBLinkTableCell

    Swift

    class HBPackageTableCell : HBLinkTableCell
  • The HBPackageNameHeaderCell class in CepheiPrefs displays a header containing the package’s icon, name, version number, and author. It can be displayed in a subtle condensed design, or, by default, a tall header that might be displayed at the top of a preference bundle’s root list controller, for instance.

    Specifier Parameters

    condensed Optional. When true, displays an icon, the package name and version in one line, and on another displays the author name. When false, displays a large package name, and on two lines in small font the package version and author. The default is false.
    icon Required in condensed mode. Not used otherwise. The file name of the icon to use within the current preference bundle.
    packageIdentifier Required. The package identifier to retrieve the required information from.
    packageNameOverride Optional. A custom name to use instead of the package’s name.
    showAuthor Optional. Whether to show the `Author` field of the package. The default is true.
    showVersion Optional. Whether to show the `Version` field of the package. The default is true.
    titleColor Optional. The color to apply to the name of the package. The default is #111111.
    subtitleColor Optional. The color to apply to the subtitles. The default is #444444.
    backgroundGradientColors Optional. An array of color stops to use as a background gradient. At least one is required. The default is no background gradient.

    Example Usage

    <!-- Standard size: -->
    <dict>
        <key>cell</key>
        <string>PSGroupCell</string>
        <key>headerCellClass</key>
        <string>HBPackageNameHeaderCell</string>
        <key>packageIdentifier</key>
        <string>ws.hbang.common</string>
    </dict>
    
    <!-- Condensed size: -->
    <dict>
        <key>cell</key>
        <string>PSGroupCell</string>
        <key>condensed</key>
        <true/>
        <key>headerCellClass</key>
        <string>HBPackageNameHeaderCell</string>
        <key>icon</key>
        <string>icon.png</string>
        <key>packageIdentifier</key>
        <string>ws.hbang.common</string>
    </dict>
    
    <!-- Standard size with custom colors: -->
    <dict>
        <key>cell</key>
        <string>PSGroupCell</string>
        <key>headerCellClass</key>
        <string>HBPackageNameHeaderCell</string>
        <key>packageIdentifier</key>
        <string>ws.hbang.common</string>
        <key>titleColor</key>
        <string>#CC0000</string>
        <key>subtitleColor</key>
        <array>
            <integer>55</integer>
            <integer>147</integer>
            <integer>230</integer>
        </array>
    </dict>
    
    <!-- Standard size with gradient background: -->
    <dict>
        <key>cell</key>
        <string>PSGroupCell</string>
        <key>headerCellClass</key>
        <string>HBPackageNameHeaderCell</string>
        <key>packageIdentifier</key>
        <string>ws.hbang.common</string>
        <key>backgroundGradientColors</key>
        <array>
            <string>#5AD427</string>
            <string>#FFDB4C</string>
            <string>#EF4DB6</string>
            <string>#898C90</string>
        </array>
    </dict>
    

    Declaration

    Objective-C

    @interface HBPackageNameHeaderCell : PSTableCell <PSHeaderFooterView>

    Swift

    class HBPackageNameHeaderCell : PSTableCell, PSHeaderFooterView
  • The HBSpinnerTableCell class in CepheiPrefs displays an activity indicator when the cell is disabled.

    Example Usage

    Specifier plist:

    <dict>
        <key>action</key>
        <string>doStuffTapped:</string>
        <key>cell</key>
        <string>PSButtonCell</string>
        <key>cellClass</key>
        <string>HBSpinnerTableCell</string>
        <key>label</key>
        <string>Do Stuff</string>
    </dict>
    

    List controller implementation:

    - (void)doStuffTapped:(PSSpecifier *)specifier {
        PSTableCell *cell = [self cachedCellForSpecifier:specifier];
        cell.cellEnabled = NO;
        // do something in the background…
        cell.cellEnabled = YES;
    }
    

    Declaration

    Objective-C

    @interface HBSpinnerTableCell : HBTintedTableCell

    Swift

    class HBSpinnerTableCell : HBTintedTableCell
  • The HBStepperTableCell class in CepheiPrefs allows setting a value using a stepper control (minus and plus buttons).

    Requires iOS 6.0 or later.

    Specifier Parameters

    label Required. The label displayed when the value is plural. Use %i to denote where the number should be displayed.
    max Required. The highest possible numeric value for the stepper.
    min Required. The lowest possible numeric value for the stepper.
    singularLabel Required. The label displayed when the value is singular.

    Example Usage

    <dict>
        <key>cellClass</key>
        <string>HBStepperTableCell</string>
        <key>default</key>
        <real>5</real>
        <key>defaults</key>
        <string>ws.hbang.common.demo</string>
        <key>key</key>
        <string>Stepper</string>
        <key>label</key>
        <string>%i Things</string>
        <key>max</key>
        <real>15</real>
        <key>min</key>
        <real>1</real>
        <key>singularLabel</key>
        <string>1 Thing</string>
    </dict>
    
    See more

    Declaration

    Objective-C

    @interface HBStepperTableCell : PSControlTableCell

    Swift

    class HBStepperTableCell : PSControlTableCell
  • The HBTintedTableCell class in CepheiPrefs ensures that a tint set with HBAppearanceSettings will also be applied to the title label of a of a cell intended to be used as a button.

    Example Usage

    <dict>
        <key>cell</key>
        <string>PSButtonCell</string>
        <key>cellClass</key>
        <string>HBTintedTableCell</string>
        <key>label</key>
        <string>Do Something</string>
    </dict>
    

    Declaration

    Objective-C

    @interface HBTintedTableCell : PSTableCell

    Swift

    class HBTintedTableCell : PSTableCell
  • The HBTwitterCell class in CepheiPrefs displays a button containing a person’s name, along with their Twitter username and avatar. When tapped, a Twitter client installed on the user’s device or the Twitter website is opened to the person’s profile.

    Specifier Parameters

    big Optional. Whether to display the username below the name (true) or to the right of it (false). The default is false. If you set this to true, you should also set the cell’s height to 56pt.
    initials Optional. One or two characters to show instead of an avatar.
    label Required. The name of the person.
    showAvatar Optional. Whether to show the avatar of the user. The default is true.
    user Required. The Twitter username of the person.

    Example Usage

    <!-- Standard size: -->
    <dict>
        <key>cellClass</key>
        <string>HBTwitterCell</string>
        <key>label</key>
        <string>HASHBANG Productions</string>
        <key>user</key>
        <string>hbangws</string>
    </dict>
    
    <!-- Big size: -->
    <dict>
        <key>big</key>
        <true/>
        <key>cellClass</key>
        <string>HBTwitterCell</string>
        <key>height</key>
        <integer>56</integer>
        <key>label</key>
        <string>HASHBANG Productions</string>
        <key>user</key>
        <string>hbangws</string>
    </dict>
    
    <!-- Without an avatar: -->
    <dict>
        <key>cellClass</key>
        <string>HBTwitterCell</string>
        <key>label</key>
        <string>HASHBANG Productions</string>
        <key>showAvatar</key>
        <false/>
        <key>user</key>
        <string>hbangws</string>
    </dict>
    

    Declaration

    Objective-C

    @interface HBTwitterCell : HBLinkTableCell

    Swift

    class HBTwitterCell : HBLinkTableCell