0
を作成するために変数を使用します。ユーレカフォーム - 私は第二行は第1の選択されたセルに依存して、ユーレカ</strong><strong>に<em><strong>セグメント化された行</strong></em>のペアを作成しようとしている.hidden述語を
私はドキュメントの「隠し行」の例を構築し、それを自分の値をハードコーディングして管理してきました。しかし、私は本当に配列によって値を指定できるようにしたいので、私はそれらを動的に変更することができ
import UIKit
import Eureka
class ViewController: FormViewController {
override func viewDidLoad() {
super.viewDidLoad()
form +++ Section("")
<<< SegmentedRow<String>("firstChoice"){
$0.selectorTitle = "firstChoice"
$0.options = ["One","Two","Three"]
$0.value = "One"
}
<<< SegmentedRow<String>("One"){
$0.hidden = "$firstChoice != 'One'" //Row is hidden unless first choice is "One"
$0.selectorTitle = "One"
$0.options = ["1-1","1-2","1-3"]
$0.value = "1-1"
}
<<< SegmentedRow<String>("Two"){
$0.hidden = "$firstChoice != 'Two'" //Row is hidden unless first choice is "Two"
$0.selectorTitle = "Two"
$0.options = ["2-1","2-2","2-3"]
$0.value = "2-1"
}
<<< SegmentedRow<String>("Three"){
$0.hidden = "$firstChoice != 'Three'" //Row is hidden unless first choice is "Three"
$0.selectorTitle = "Three"
$0.options = ["3-1","3-2","3-3"]
$0.value = "3-1"
}
}
}
:ここ は、行は次のようになりSPECものです。私は.hidden
プロパティの述語関数を構築するときに問題にぶつかります。 私はこれをしたい:
import UIKit
import Eureka
let ChoiceOne = ["One", "Two", "Three"]
let ChoiceTwo = [["1-1","1-2","1-3"],["2-1","2-2","2-3"],["3-1","3-2","3-3"]]
class ViewController: FormViewController {
override func viewDidLoad() {
super.viewDidLoad()
form +++ Section("")
<<< SegmentedRow<String>("firstChoice"){
$0.selectorTitle = "firstChoice"
$0.options = ChoiceOne
$0.value = ChoiceOne[0]
}
<<< SegmentedRow<String>("One"){
$0.hidden = "$firstChoice != ChoiceOne[0]" //Row is hidden unless first choice is "One"
$0.selectorTitle = ChoiceOne[0]
$0.options = ChoiceTwo[0]
$0.value = ChoiceTwo[0][0]
}
<<< SegmentedRow<String>("Two"){
$0.hidden = "$firstChoice != ChoiceOne[1]" //Row is hidden unless first choice is "One"
$0.selectorTitle = ChoiceOne[1]
$0.options = ChoiceTwo[1]
$0.value = ChoiceTwo[1][0]
}
<<< SegmentedRow<String>("Three"){
$0.hidden = "$firstChoice != ChoiceOne[2]" //Row is hidden unless first choice is "One"
$0.selectorTitle = ChoiceOne[2]
$0.options = ChoiceTwo[2]
$0.value = ChoiceTwo[2][0]
}
}
}
これはOK構築しますが、実行時に、私は次のエラーを取得:に文字列として正しく渡されません、私はChoiceOne[0]
を想定してい
2017-05-21 07:41:27.547 EurekaTest[74681:12894860] *** NSForwarding: warning: object 0x7fa248e15f50 of class '_TtGC6Eureka12SegmentedRowSS_' does not implement methodSignatureForSelector: -- trouble ahead
Unrecognized selector -[_TtGC6Eureka12SegmentedRowSS_ valueForKey:]
を述語作成者ですが、私は、短期間を把握するためのこの構成については十分に理解していません。
さらに、私は可変サイズのsegmentedRowを構築するために、配列のサイズをループすることができます。