首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将自定义推送行迁移到Eureka 4.1

将自定义推送行迁移到Eureka 4.1
EN

Stack Overflow用户
提问于 2018-03-27 19:45:48
回答 1查看 807关注 0票数 1

我很难将自定义行从Eureka的早期版本(大约3.0)迁移到Eureka 4.1。自定义行是自定义推送行,因此标签可以有多行,因此被推送的视图控制器可以有一个自定义节头。可能有更好的方法来实现这一点,而不是有一个自定义行,所以这是一个可能的解决方案,但我不确定这是否可能。

因此有两个问题:自定义行和自定义选择器视图控制器。以下是自定义行:

代码语言:javascript
复制
open class _StackedPushRow: SelectorRow<StackedPushCell, CustomSelectorViewController<String>> {

    public typealias StackedRow = PushRow<String>

    var dontClearWhenDisabled: Bool = false

    required public init(tag: String?) {
        super.init(tag: tag)
        cellProvider = CellProvider(nibName: "StackedPushCell")

        presentationMode = .show(controllerProvider: ControllerProvider.callback {
            return CustomSelectorViewController<Cell.Value> { _ in } },
         onDismiss: { vc in
            self.cell.update()
            _ = vc.navigationController?.popViewController(animated: true)
        })
    }
}

/// A generic inline row where the user can pick an option from a presented view controller
public final class StackedPushRow: _StackedPushRow, RowType {

    required public init(tag: String?) {
        super.init(tag: tag)
    }

}

以下是自定义选择器视图控制器:

代码语言:javascript
复制
public final class CustomSelectorViewController<T: Equatable>: SelectorViewController<T> {

    open override func viewDidLoad() {
        super.viewDidLoad()

        form.first?.header = HeaderFooterView.caliberStyleSectionHeader(title: row.title ?? "")
    }

    static func presentationMode<T: Equatable>() -> PresentationMode<SelectorViewController<T>> {
        return .show(controllerProvider: ControllerProvider.callback {
            return CustomSelectorViewController<T> { _ in }
        }, onDismiss: { vc in
            _ = vc.navigationController?.popViewController(animated: true)
        })
    }
}

以下是自定义行的错误:

/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:78:29:泛型类型“SelectorRow”专用于过多的类型参数(got 2,但预期为1) /Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:85:9:‘超级’成员不能在根类/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:86:9:中引用,不能使用未解析的标识符'cellProvider‘/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:88:9:未解决的标识符‘/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:98:20:’/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:98:20:类型'StackedPushRow‘不符合协议'BaseRowType’/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:98:20: Type 'StackedPushRow‘不符合协议'RowType’/User/R棒/Document/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:98:20:候选对象具有非匹配类型“(字符串?/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:98:20:类型的'StackedPushRow‘不符合协议'Taggable’/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:98:20: Type 'StackedPushRow‘不符合协议'TypedRowType’/User/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:111:9:未解析标识符'validationOptions‘/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomRows/StackedPushRow.swift:141:9:'StackedPushRow’的使用不是BaseRow的子类型

以下是自定义选择器视图控制器的错误:

/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomSelectorViewController.swift:12:64:类型'T‘不符合协议'OptionsProviderRow’/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomSelectorViewController.swift:14:24:方法不覆盖其超类/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomSelectorViewController.swift:15:中的任何方法9:在根类/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomSelectorViewController.swift:17:9:中不能引用“超级”成员--使用未解析的标识符‘表单’/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/UI/Common/CustomSelectorViewController.swift:17:80:使用未解析的标识符‘行’/Users/rod/Documents/Development/Caliber/CaliberiOS/H2O/_iOS/H2O/传递给不带参数的调用的UI/Common/CustomSelectorViewController.swift:22:52:参数

我读过关于Github的问题部分,也看到过其他人遇到这种情况的例子,但是每次我尝试将这些例子付诸于实践时,我都会遇到其他的问题,我只是不停地循环运行。我真的需要帮助。

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2018-04-02 17:22:54

SelectorRow现在只采用一般单元格类型,而不采用视图控制器。SelectorViewController由presentationMode定义。您应该声明您的行如下:open class _StackedPushRow: SelectorRow<StackedPushCell>

对于CustomSelectorViewController,您需要传递要作为泛型类型使用的rowType。该行类型必须符合OptionsProviderRow,例如ListCheckRow。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49521252

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档