Option Property Cell : Gives the ability to fully customize each option rows that are presented in the Option Table View using a cellController factory block that can be defined as a property of the CKOptionPropertyCellController or as an extended attribute of the edited property.

Example : We represent the fontName property of a PXInterTitle instance as a CKTableViewCellController.

As we define extended attributes with valuesAndLabels for this property, the resulting cell controller of cellControllerWithObject:keyPath: will be an instance of CKOptionPropertyCellController. The options that can be selected for this property will be represented by the cell controllers returned by the optionCellControllerCreationBlock defined in the property's extended attributes. So that, as we represent font names, each row will display the fontName by setting the right font on the UITableViewCell textLabel.

//Creating the cell controller that will get placed in a CKFormTableViewController

CKTableViewCellController* fontCell  = [CKTableViewCellController cellControllerWithObject:self.interTitle keyPath:@"fontName"];

//Defining the extended attributes for the PXInterTitle fontName property that will get used by CKOptionPropertyCellController for
//representing and editing this property.

@implementation PXInterTitle(Edition)

- (void)fontNameExtendedAttributes:(CKPropertyExtendedAttributes*)attributes{
    NSMutableDictionary* allFonts = [NSMutableDictionary dictionary];

    NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
    for (NSString* familyName in familyNames)
    {
        NSArray * fontNames = [[NSArray alloc] initWithArray:[UIFont fontNamesForFamilyName:familyName]];
        for(NSString* fontName in fontNames){
            [allFonts setObject:fontName forKey:fontName];
        }
    }

    attributes.valuesAndLabels = allFonts;
    attributes.sortingBlock = ^(id value1, NSString* label1,id value2, NSString* label2){
        return [label1 compare:label2];
    };

    attributes.optionCellControllerCreationBlock = ^(NSString* label, id value){
        CKTableViewCellController* cell = [CKTableViewCellController cellControllerWithTitle:label action:nil];
        [cell setSetupBlock:^(CKTableViewCellController *controller, UITableViewCell *cell) {
            NSString* fontName = (NSString*)value;
            cell.textLabel.font = [UIFont fontWithName:fontName size:14];
        }];
        return cell;
    };
}

@end