我试图以这种方式将CLFormRowDescriptor连接到视图控制器:

    var form = XLFormDescriptor()

    var section : XLFormSectionDescriptor
    var row : XLFormRowDescriptor

    form = XLFormDescriptor(title: "ABC") as XLFormDescriptor

    section = XLFormSectionDescriptor.formSectionWithTitle("Bla bla") as XLFormSectionDescriptor
    form.addFormSection(section)

    row = XLFormRowDescriptor(tag: "bla", rowType: XLFormRowDescriptorTypeSelectorPush, title: "BlaBla");
    row.action.viewControllerStoryboardId = "test";
    section.addFormRow(row)


并且视图控制器情节提要ID为test
运行应用程序时,出现以下错误消息:


  2015-07-03 16:42:24.022 TestTest [1001:203160] ***
  
  -[XLFormSelectorCell formDescriptorCellDidSelectedWithFormController:],/ Users / valec / Developer / TestTest / ios / Pods / XLForm / XLForm / XL / Cell / XLFormSelectorCell.m:166中的断言失败
  
  2015-07-03 16:42:24.024 TestTest [1001:203160] ***
  
  由于未捕获的异常“ NSInternalInconsistencyException”而终止应用程序,原因:“ rowDescriptor.action.viewControllerClass必须符合XLFormRowDescriptorViewController协议”
  ***首先抛出调用堆栈:
  
  (0x18246c2d8 0x1941400e4 0x18246c198 0x183320ed4 0x100387a5c 0x100398680 0x10039c6d0 0x18700d408 0x1870c7724 0x186f681d4 0x186ed8680 0x1824242a4 0x182421230 0x182421610 0x18234b4d 0xc
  libc ++ abi.dylib:以NSException类型的未捕获异常终止


您是否有解决此问题的想法?您是否需要其他代码或信息?

最佳答案

由于您的行类型为XLFormRowDescriptorTypeSelectorPush XLForm推断您要实现自定义选择器,并尝试将行描述符(包含当前选定值)传递给选择器视图控制器(在您的情况下为“测试”为情节提要ID)。

使“测试”视图控制器符合XLFormRowDescriptorTypeSelectorPush来解决您的问题。

10-06 06:37