2017-07-26 74 views
1

設置

  • 雨燕3.1
  • iOS的10.0
  • 尤里卡3.0

問題

不能做出LabelRow隱藏連同一個TextAreaRow隱藏狀態。將標籤添加到部分之前定義標籤。它被添加到文本的頂部。iOS的Eureka-形式LabelRow隱藏條件不評估

代碼

幾種不同的方式來定義Condition,在調試時,似乎功能後沒有得到調用。只有在第2它被調用一次,但不能當TextAreaRow變爲隱藏或顯示

let switchRowTag = "switchRowTag" 
    form +++ section 
     <<< SwitchRow(switchRowTag) { row in 
      row.title = "Select me"} 

    // Test hiding functions ======================== 
    let tag = "textArea" 
    let title = "Test Hiding" 
    let labelTag = "\(tag)_label" 
    let textArea = TextAreaRow(tag) { 
     $0.title = title 
     $0.tag = tag 
     $0.placeholder = title 
     $0.textAreaHeight = .dynamic(initialTextViewHeight: 110) 
     $0.hidden = Condition.predicate(NSPredicate(format: "$\(switchRowTag) == false")) 
    } 
    let labelRow = LabelRow(labelTag) { 
     $0.title = title 
     $0.tag = labelTag 
     /* try setting the function after adding to the section 
     $0.hidden = Condition.function([tag], { form in 
      if let textRow = form.rowBy(tag: tag) as? TextAreaRow { 
       return textRow.isHidden 
      } else { 
       return false 
      } 
     }) 
     */ 
    } 

    section <<< labelRow <<< textArea 
    // Is never evaluated 
    /* 
    labelRow.hidden = Condition.function([tag], { form in 
     if let textRow = form.rowBy(tag: tag) as? TextAreaRow { 
      return textRow.isHidden 
     } else { 
      return false 
     } 
    }) 
    */ 
    if let labelRow = form.rowBy(tag: labelTag) as? LabelRow { 
     labelRow.hidden = Condition.function([tag], { form in 
      if let textRow = form.rowBy(tag: tag) as? TextAreaRow { 
       return textRow.isHidden 
      } else { 
       return false 
      } 
     }) 
    } 
+0

看來沒有簡單的方法來向TextAreaRow添加標題,所以我試圖添加一個LabelRow。希望條件來自另一行的隱藏狀態的原因是條件都是分開處理的。 – Efren

回答

0

它目前不支持。

尤里卡只支持重新評估隱藏的條件,當標籤所依賴的行有更改值只有。不能改變能見度(r ef)。