私は迅速にXLFormを使用しており、いくつかの「通常の」セルとカスタムセルを次のようにフォームに追加しました:
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!)
didTouchButton
次に、次の方法で実装しました。
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)
}
「通常の」(カスタムではない)セルの場合、セレクターは正常に機能しますが、カスタムセルの場合、メソッドさえ呼び出されません。考えられる理由を知っている人はいますか?ありがとう
編集:XLFormButtonCell
代わりにカスタムセルをオーバーライドさせることで解決しましたXLFormBaseCell