XLForm: Selector of custom cell not calling method

451 Views Asked by At

I am using XLForm in swift and added some "normal" cells and a custom cell to my form like this:

XLFormViewController.cellClassesForRowDescriptorTypes().setObject("MyCell", forKey: "MyCellType")
section = XLFormSectionDescriptor.formSectionWithTitle(NSLocalizedString("Section1Title", comment: "")) as! XLFormSectionDescriptor
        form.addFormSection(section)

row = XLFormRowDescriptor(tag: Tags.Pair, rowType:"MyCellType", title: NSLocalizedString("Pair", comment: ""))
row!.cellConfigAtConfigure["titleLabel.text"] = "hello world"
row!.cellConfigAtConfigure["progressView.hidden"] = true
row!.action.formSelector = #selector(ChestbeltSettingsViewControllerImpl.didTouchButton(_:))
section!.addFormRow(row!)

then I implemented didTouchButton the following way:

func didTouchButton(sender: XLFormRowDescriptor) {
print("didTouchButton")    
switch sender.tag {
    case Tags.ShowHelp:
        print("showHelp")
        break
    case Tags.Pair:
        print("pair")
        break
    default: break
    }

    self.deselectFormRow(sender)
}

for the "normal" (not custom) cells the selector works fine, but for my custom cell not even the method is getting called. Does anybody know a possible reason? Thanks

EDIT: I solved it by letting my custom cell override XLFormButtonCell instead of XLFormBaseCell

0

There are 0 best solutions below