简体   繁体   中英

When Eureka PickerInlineRow value is added via cell.detailTextLabel, form.values() shows initial text

  • Environment: Eureka: 5.2.1 Xcode: 11.4 iOS version: 13.4

TLDR; When I try to print the values out from the form, the text changes to the initial text

When row is tapped on, I programmatically enter in the first item in an array. This populates the value of the cell and I can move on to a different row.

        let fruit = ["Apple", "Peach", "Pear"]
        <<< PickerInlineRow<String>(){
            $0.title = "Fruits"
            $0.options = fruit
            $0.tag = "pickerTag"
            $0.value = "Select your favorite"
        }
        .onExpandInlineRow({ (cell, inlineRow, row) in
            cell.detailTextLabel?.text = fruit[0]
        })

When I click my "Review" button I try to print out the response from the pickerRow and I do not get what is actually in the cell I get a response of the initial text (ie Select your favorite)

    <<< ButtonRow("Review") {
       $0.title = "Review"
    }
    .onCellSelection { [weak self] (cell, row) in
        self?.printoutValues()
    }

in printoutValues func

   let values = form.values()
   print("picklerValue: \(values["pickerTag"] as? String)")

If a user actually moves the picker view instead of just tapped on the row and then to the next row then the value is printed correctly.

How can I populate the row when a user first taps on the row and have it save?

thanks

I believe this only stopped working in newer versions of Eureka, but anyways I figured it out.

In .onExpandInlineRow

you have to add inlineRow.value = fruit[0]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM