选择选项时,带有SegmentedRow的Xcode Eureka Loop会崩溃

时间:2018-06-14 20:21:58

标签: ios xcode eureka-forms

我正在使用xure swift的Eureka插件,并在选择“OTHER”选项时遇到应用程序崩溃的问题。如果选择“OTHER”,它应该在日期之下有一个TextRow。

错误:线程1:断言失败:重复标记段

我很确定问题是<<< SegmentedRow<String>("segments"){没有增加“segments1”,“segments2”等等...每个循环行。另外,如果段必须增加,我不知道如何使$0.hidden行有效:$0.hidden = "$segments != 'OTHER'"

form
            +++ Section()

            for (index, date) in fdates.enumerated() {
                form.last!
                <<< SegmentedRow<String>("segments"){
                    $0.title = date
                    $0.options = ["FULL", "AM", "PM", "OTHER"]
                    $0.value = "FULL"
                    }.cellUpdate { cell, row in

                        cell.segmentedControl.setContentHuggingPriority(.defaultHigh, for: .horizontal)

                        if (self.type == "Lieu") {
                            cell.segmentedControl.setWidth(CGFloat(47), forSegmentAt: 0)
                            cell.segmentedControl.setWidth(CGFloat(40), forSegmentAt: 1)
                            cell.segmentedControl.setWidth(CGFloat(40), forSegmentAt: 2)
                            cell.segmentedControl.setWidth(CGFloat(57), forSegmentAt: 3)
                        }

                        //print(index)
                    }

                +++ Section(){
                    $0.tag = "other_\(index)"
                    $0.hidden = "$segments != 'OTHER'" 
                }
                <<< TextRow(){
                    $0.title = "This will be changed to a time picker after..."
                }
            }

** 编辑 **我设法通过使用带有“细分”的索引行来停止崩溃,但单击“OTHER”时TextRow仍未显示:

let tag = "segments\(index)"
<<< SegmentedRow<String>(tag){

+++ Section(){
    $0.tag = "other\(index)"
    $0.hidden = Condition(stringLiteral: "$segments\(index) != 'OTHER'")
}

enter image description here enter image description here

1 个答案:

答案 0 :(得分:0)

作者告诉我将form +++ Section()移到<<< SegmentedRow<String>(tag){之前的循环中,这可行。

for (index, date) in fdates.enumerated() {
    form +++ Section()
    let tag = "segments\(index)"
     <<< SegmentedRow<String>(tag){
         $0.title = date