CepheiPrefs

From iPhone Development Wiki
Jump to: navigation, search
CepheiPrefs
Cydia Package
Developer HASHBANG
Package ID ws.hbang.common
Latest Version 1.16

CepheiPrefs is a framework that provides preference related convenience methods.

How to use this framework

Headers are available from Cephei’s Github project and the framework can be found at /Library/Frameworks/Cephei.framework on a device where Cephei is installed. Theos and Dragon both include the headers so you don’t have to worry about installing them!

Include directive

#import <CepheiPrefs/CepheiPrefs.h>

Makefile

Add to your preference bundle Makefile: CepheiPrefs to the XXX_EXTRA_FRAMEWORKS variable.

Dragon

Add to your DragonMake file: CepheiPrefs to the frameworks in the preferences module.

Packaging

Add to your package’s control file: ws.hbang.common to the Depends field.

Getting preferences to work with Cephei

In order to use CepheiPrefs features you need to subclass HBRootListController for the root controller or HBListController

@interface XXXRootPreference : HBRootListController
@end

@implementation XXXRootPreference
    // Any normal preference actions here
@end

Changing a pane’s appearance

The HBAppearanceSettings class provides methods to change the appearance of a preference pane from colors to changing status bar style

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

    if (self) {
        HBAppearanceSettings *appearanceSettings = [[HBAppearanceSettings alloc] init];
        appearanceSettings.tintColor = [UIColor blackColor];
        // Applying
        self.hb_appearanceSettings = appearanceSettings;
    }

    return self;
}
@end

Using custom preference cells

CepheiPrefs also provides custom preference cells, to use them, put them in a preference plist that subclasses HBRootListController or HBListController

Image cell

Display an image in a cell.

<dict>
    <key>cellClass</key>
    <string>HBImageTableCell</string>
    <key>height</key>
    <integer>50</integer>
    <key>icon</key>
    <string>icon.png</string>
</dict>

HBLinkTableCell

Displays a button when tapped, goes to the URL. Can be used with or without any cell type but setting to PSButtonCell applies a tint to it.

<dict>
    <key>cellClass</key>
    <string>HBLinkTableCell</string>
    <key>label</key>
    <string>iPhone Dev Wiki</string>
    <key>url</key>
    <string>https://iphonedev.wiki</string>
</dict>

HBPackageTableCell

Displays a package cell with icon and name and when tapped, opens package in Cydia.

<dict>
    <key>cellClass</key>
    <string>HBPackageTableCell</string>
    <key>label</key>
    <string>Chirp</string>
    <key>packageIdentifier</key>
    <string>some.package.id</string>
    <!-- If package is not in a default repo, include this -->
    <key>packageRepository</key>
    <string>https://some.repo.com</string>
</dict>

HBTwitterCell

Displays a cell with name and Twitter avatar.

<dict>
    <key>cellClass</key>
    <string>HBTwitterCell</string>
    <key>label</key>
    <string>exampleName</string>
    <key>user</key>
    <string>exampleUser</string>
</dict>

See also

External links