I have a UIPickerView. I have a blank array set up until my code parses an XML request. So when it does I want it to populate the array with that data. Below is how I have everything set up.
var pickerData = []
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerData.count
}
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
return pickerData[row] as String
}
func parser(parser: NSXMLParser!, foundCharacters string: String!) {
if (seperatedSoap == "pickerDataString") {
if (currentElementName == "name") {
pickerData = [string]
println(pickerData)
}
}
I obviously didn't paste every bit of code but you should be able to understand what's going on here. Now my console prints this as my pickerData after parsing.
(
"2x1 on recv-small"
)
(
"2x1 on ship-small"
)
(
"3x2 on avs-1"
)
(
"2.25x2 on photo-large"
)
(
"2.25x2 on recv-large"
)
(
"2.25x2 on repair-large"
)
(
"2x3 on wireless-1"
)
(
"4x6 on ship-shiplbl"
)
(
"4x6 on recv-shiplbl"
)
(
"4x6 on wireless-shiplbl"
)
Which is exactly what I want but it's not showing up in my UIPickerView because apparently it's blank? What am I doing wrong here?