[英]Swift Eureka SelectableSection baseValue doesn't work correctly
[英]SelectableSection Update another Section in Eureka Swift
我的Eureka表單中有這個帶有圖像的SelectableSection
。
+++ SelectableSection<ImageCheckRow<String>>("Τρόπος Αποστολής", selectionType: .singleSelection(enableDeselection: true)) { section in
section.tag = "troposapostolis"
}
<<< ImageCheckRow<String>("speedex"){
$0.title = "Σταθερή Χρέωση - 3,00€\n SPEEDEX (Για όλη την Ελλάδα)"
$0.selectableValue = ""
$0.value = nil
}.cellSetup { cell, _ in
cell.trueImage = UIImage(named: "selectedRectangle")!
cell.falseImage = UIImage(named: "unselectedRectangle")!
}.onCellSelection({ (cell, row) in
row.title = "speedex"
row.selectableValue = "selectedspeedex"
})
<<< ImageCheckRow<String>("paradosi"){
$0.title = "Αυθημερόν Παράδοση - 6,00€\n Ισχύει για ορισμένες περιοχές εντός Αττικής. Υποβολή παραγγελίας μέχρι τις 14:00."
$0.selectableValue = ""
$0.value = nil
}.cellSetup { cell, _ in
cell.trueImage = UIImage(named: "selectedRectangle")!
cell.falseImage = UIImage(named: "unselectedRectangle")!
}.onCellSelection({ (cell, row) in
row.title = "paradosi"
row.selectableValue = "selectedparadosi"
})
我想在用戶點擊以上任何選項時更新另一個部分。 這是我要更新的部分->自定義單元格
+++ Section("summary")
<<< SummaryPuchaseRow().cellUpdate({ (cell, row) in
cell.merikoSinolo.text = "\(self.realmfunctions.getAmount())€"
cell.sum.text = "" \\value depending on the image selected
})
因此,如果用戶點擊SelectableSection
的第一行,我希望
cell.sum.text = "3"
如果用戶點擊SelectableSection
的第二行,我會
cell.sum.text = "6"
有什么有效的方法嗎? 非常感謝!
您需要使用一個標記,以便在onCellSelection
搜索中從Form中獲取您的單元格並定義已定義標記的單元格,並在這種情況下讓該單元格更改控件上的值sum.text
,這是代碼
+++ SelectableSection<ImageCheckRow<String>>("Τρόπος Αποστολής", selectionType: .singleSelection(enableDeselection: true)) { section in
section.tag = "troposapostolis"
}
<<< ImageCheckRow<String>("speedex"){
$0.title = "Σταθερή Χρέωση - 3,00€\n SPEEDEX (Για όλη την Ελλάδα)"
$0.selectableValue = ""
$0.value = nil
}.cellSetup { cell, _ in
cell.trueImage = UIImage(named: "selectedRectangle")!
cell.falseImage = UIImage(named: "unselectedRectangle")!
}.onCellSelection({ (cell, row) in
row.title = "speedex"
row.selectableValue = "selectedspeedex"
if let summaryRow = self.form.rowBy(tag: "important") as? SummaryPuchaseRow
{
if let baseCellSummary = summaryRow.baseCell as? ???? //ATTENTION!!! put here your cell type name
{
baseCellSummary.sum.text = "3"
}
}
})
<<< ImageCheckRow<String>("paradosi"){
$0.title = "Αυθημερόν Παράδοση - 6,00€\n Ισχύει για ορισμένες περιοχές εντός Αττικής. Υποβολή παραγγελίας μέχρι τις 14:00."
$0.selectableValue = ""
$0.value = nil
}.cellSetup { cell, _ in
cell.trueImage = UIImage(named: "selectedRectangle")!
cell.falseImage = UIImage(named: "unselectedRectangle")!
}.onCellSelection({ (cell, row) in
row.title = "paradosi"
row.selectableValue = "selectedparadosi"
if let summaryRow = self.form.rowBy(tag: "important") as? SummaryPuchaseRow
{
if let baseCellSummary = summaryRow.baseCell as? ???? //ATTENTION!!! put here your cell type name
{
baseCellSummary.sum.text = "3"
}
}
})
並且您需要為您的SummaryRow設置標簽,在本示例中,我將“ important”用作標簽
+++ Section("summary")
<<< SummaryPuchaseRow(tag: "important").cellUpdate({ (cell, row) in
cell.merikoSinolo.text = "\(self.realmfunctions.getAmount())€"
cell.sum.text = "" \\value depending on the image selected
})
希望這對您有所幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.