0

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

    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)

并且视图控制器 Storyboard ID 是test. 当我运行应用程序时,我收到以下错误消息:

2015-07-03 16:42:24.022 测试测试[1001:203160] ***

-[XLFormSelectorCell formDescriptorCellDidSelectedWithFormController:] 中的断言失败,/Users/valec/Developer/TestTest/ios/Pods/XLForm/XLForm/XL/Cell/XLFormSelectorCell.m:166

2015-07-03 16:42:24.024 测试测试[1001:203160] ***

由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“rowDescriptor.action.viewControllerClass 必须符合 XLFormRowDescriptorViewController 协议”*** 首先抛出调用堆栈:

(0x18246c2d8 0x1941400e4 0x18246c198 0x183320ed4 0x100387a5c 0x100398680 0x10039c6d0 0x18700d408 0x1870c7724 0x186f681d4 0x186ed8680 0x1824242a4 0x182421230 0x182421610 0x18234d2d4 0x18bda36fc 0x186f4af40 0x100028e8c 0x1947eaa08) libc++abi.dylib: terminating with uncaught exception of type NSException

你知道如何解决这个问题吗?您需要任何进一步的代码或信息吗?

4

1 回答 1

0

由于您的行类型是XLFormRowDescriptorTypeSelectorPushXLForm 推断您想要实现自定义选择器并尝试将行描述符(包含当前选定值)传递给选择器视图控制器(在您的情况下,视图控制器“测试”为故事板 id ) .

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

于 2015-07-06T16:55:26.193 回答