nicklockwood / FXForms

[DEPRECATED]
Other
2.93k stars 339 forks source link

Cell customization and subforms #383

Open nameghino opened 9 years ago

nameghino commented 9 years ago

Hello,

I'm working on a two-level form that I had to customize the cells for FXFormFieldTypeText. As per the examples, I registered the class using

    Class klass = NSClassFromString(@"SettingsFormTopBottomCell");
    [self.formController registerCellClass:klass forFieldType:FXFormFieldTypeText];

The thing is that this customization doesn't seem to carry on when going into the second level of the form. Then, I looked into the FXForms code and found this:

// snip
- (Class)cellClassForField:(FXFormField *)field
{
    if (field.type != FXFormFieldTypeDefault)
    {
        return self.cellClassesForFieldTypes[field.type] ?:
        self.parentFormController.cellClassesForFieldTypes[field.type] ?:
        self.cellClassesForFieldTypes[FXFormFieldTypeDefault];
    }
// snip

The form controller always fills up its cellClassesForFieldTypes[field.type], so at no point (barring some removal of a field type) the check will return parentFormController.cellClassesForFieldTypes[field.type], am I right?

Is this kind of customization supposed to be applied to the whole form hierarchy? If not, which is the proper way of doing it?

Thanks!