我正试图通过以下方式将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测试【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】***
由于未捕获的异常"NSInternalConsistencyException"而终止应用,原因:"rowDescriptor.action.viewControllerClass必须符合XLFormRowDescriptorViewController协议"***首次抛出调用堆栈:
(0x18246c2d8 0x1941400e4 0x18246c198 0x183320ed4 0x100387a5c 0x100398680 0x10039c6d0 0x18700d408 0x1870c7724 0x186f681d4 0x186ed8680 0x1824242a4 0x182421230 0x182421610 0x18234d2d4 0x18da36fc 0x186f4af40 0x100028e8c 0x1947eaa08(libc++abi.dylib:以NSException 类型的未捕获异常终止
你知道如何解决这个问题吗?你需要更多的代码或信息吗?
由于您的行类型是XLFormRowDescriptorTypeSelectorPush
,XLForm推断您想要实现一个自定义选择器,并尝试将行描述符(包含当前选定值(传递给选择器视图控制器(在您的情况下,是作为情节提要id"测试"的视图控制器(。
使"测试"视图控制器符合XLFormRowDescriptorTypeSelectorPush
以解决您的问题。