4

I am using XLForm with XLFormRowDescriptor. Everything else is working fine but I have a requirement where I want to use custom row with Images and Text. In addition I need to do XLFormRowDescriptorTypeSelectorPush on the XLFormRowDescriptor action.

Mystery
  • 552
  • 6
  • 14

1 Answers1

0

Subclass from XLFormBaseCell (you can also create custom xib if you prefer to use IB), and implement

+ (void)load {    
    XLFormViewController.cellClassesForRowDescriptorTypes[@"YOUR_UNIQ_TYPE"] = NSStringFromClass([CHILD_OF_XLFormBaseCell class]);
}

- (void)configure {
    [super configure];
}

- (void)update {
    [super update];
}

+ (CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor;

To not use default actions (like XLFormRowDescriptorTypeSelectorPush) you can override this method:

- (void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller {
//anything you want, for example
    if (self.rowDescriptor.action.formBlock) {
        self.rowDescriptor.action.formBlock(self.rowDescriptor);
    }
}

Then you will be able to create XLFormRowDescriptor using

- (instancetype)initWithTag:(NSString *)tag rowType:(NSString *)rowType title:(NSString *)title;
Pavel Rudkouski
  • 156
  • 1
  • 4