删除Eureka中单行的分隔线

时间:2017-01-02 10:36:47

标签: ios swift uitableview eureka-forms

如何删除Eureka表单中单行的分隔线?

我想删除tableview中的最后一行,即描述行下面的那一行。当我通过常规tableview环顾四周寻找这个问题的解决方案时,最常用的解决方案是通过设置一个大的分隔符插入来将特定单元格的分隔线推出屏幕。像这样:

form.last! <<< TextAreaRow("description row") {
    $0.placeholder = "Description of the issue"
    $0.textAreaHeight = .dynamic(initialTextViewHeight: 44)
}.cellSetup{ cell, row in
    cell.separatorInset = UIEdgeInsets(top: 0, left: 2000, bottom: 0, right: 0)
}.onChange{ [weak self] in
    self?.issueMessage = $0.value ?? ""
}

我在viewDidLoad上调用它,但它似乎没有任何效果。我是Eureka的新手。

Screenshot of Eureka form

2 个答案:

答案 0 :(得分:0)

试试这段代码:

form.last! <<< TextAreaRow("description row") {
            $0.placeholder = "Description of the issue"
            $0.textAreaHeight = .dynamic(initialTextViewHeight: 44)
        }.cellSetup{ (cell, row) in
            if(row != 3) {
                cell.separatorInset = UIEdgeInsets(top: 0, left: 2000, bottom: 0, right: 0)
            }
        }.onChange{ [weak self] in
            self?.issueMessage = $0.value ?? ""
        }

我添加了检查(行!= 3),考虑到你只有4行,而第4个索引将是3,因为它从0开始。

答案 1 :(得分:0)

斯威夫特 4、5

layoutSubview

public override func layoutSubviews() {
        super.layoutSubviews()
        for view in self.subviews where view != self.contentView {
            if NSStringFromClass(type(of: view)).contains("_UITableViewCellSeparatorView")
                view.removeFromSuperview()
            }
        }
    }