2016-06-07 8 views
0

Ich habe diesen Code:Eureka erhalten SelectableSection nach Tag

form +++= SelectableSection<ImageCheckRow<String>, String>("branch_section", selectionType: .MultipleSelection) { section in 
     section.header = HeaderFooterView(title: "Branches") 
    } 

    for branch in sharedBranch.branchList { 
     form.last! <<< ImageCheckRow<String>(branch.name){ row in 
      row.title = branch.name 
      row.baseValue = branch.id 
      row.selectableValue = branch.name 
      row.value = nil 
     } 
    } 

aber ich kann selectedRows nicht bekommen, habe ich versucht:

let branch_section = self.form.sectionByTag("branch_section") as? SelectableSection<ImageCheckRow<String>, String> 
    print(branch_section) 
    print(branch_section.selectedRows()) 

beide Drucke nil

Antwort

2

Um dies zu tun , müssen Sie diese

form +++= SelectableSection<ImageCheckRow<String>, String>("branch_section", selectionType: .MultipleSelection) 
form.last!.header = HeaderFooterView(title: "Branches") 
form.last!.tag = "branch_section" 
verwenden

statt

form +++= SelectableSection<ImageCheckRow<String>, String>("branch_section", selectionType: .MultipleSelection) { section in 
    section.header = HeaderFooterView(title: "Branches") 
} 

dann Ihrem Code

let branch_section = self.form.sectionByTag("branch_section") as? SelectableSection<ImageCheckRow<String>, String> 
print(branch_section) 
print(branch_section.selectedRows()) 

als der bestimmungsgemäßen arbeiten, ich hoffe das Ihnen

hilft