gpt4 book ai didi

swift - CLFormRowDescriptor 未连接到 View Controller

转载 作者:行者123 更新时间:2023-11-30 14:15:46 25 4
gpt4 key购买 nike

我正在尝试以这种方式将 CLFormRowDescriptor 连接到 View Controller :

    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)

View Controller Storyboard ID 为 test。当我运行该应用程序时,收到以下错误消息:

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

Assertion failure in -[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] ***

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'rowDescriptor.action.viewControllerClass must conform to XLFormRowDescriptorViewController protocol' *** First throw call stack:

(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

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

最佳答案

由于您的行类型是 XLFormRowDescriptorTypeSelectorPush XLForm 推断您想要实现自定义选择器,并尝试将行描述符(包含当前选定的值)传递到选择器 View Controller (在您的情况下是“测试”作为 Storyboard id 的 View Controller )。

使“测试” View Controller 符合 XLFormRowDescriptorTypeSelectorPush解决您的问题。

关于swift - CLFormRowDescriptor 未连接到 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31209971/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com