xmartlabs / XLForm

XLForm is the most flexible and powerful iOS library to create dynamic table-view forms. Fully compatible with Swift & Obj-C.
MIT License
5.77k stars 953 forks source link

Multiple choice/single selection list? #253

Open AndrewHartAR opened 9 years ago

AndrewHartAR commented 9 years ago

I'm not sure if this is a feature already or not.

I'd like to offer the user a number of choices, for example:

Temperature Scale: Celsius Fahrenheit

With those as separate cells instead of a segmented control.

Because it's the only option in my form, I'd like them to be able to do this inline, without going to another page.

Perhaps there's a selector or something where I can be notified of a change to a cell?

AndrewHartAR commented 9 years ago

I've now tried this:

    self.fahrenheitRow.title = TemperatureScale.Fahrenheit.string()
    self.celsiusRow.title = TemperatureScale.Celsius.string()

    self.settingsForm.delegate = self

    let section = XLFormSectionDescriptor()
    section.title = "Temperature Scale"

    self.fahrenheitRow.value = self.temperatureScale == .Fahrenheit
    section.addFormRow(self.fahrenheitRow)

    self.celsiusRow.value = self.temperature

    self.settingsForm.addFormSection(section)

And I have the method:

func formRowDescriptorValueHasChanged(formRow: XLFormRowDescriptor!, oldValue: AnyObject!, newValue: AnyObject!) {
    println("form row descriptor value has changed")

}

The problem is that now this delegate method simply isn't being called when I highlight one of these rows.