I am facing an issue in this since a long.
- Problem:
I need to get value as per the index of following array in my tableView.
indexArray = [3, 6, 4, 5, 8, 30, 31, 7, 18, 29, 1]
paramNameArray = ["Date", "Sync Time", "UUC2T7", "Set MD", "Total KVA", "Total KW", "Running MD", "SMS 1 KW", "P.F.", "ET-5 KW", "ET-3_4 KW", "ET- 6_7 KW", "ABP-1 KW", "ABP-1A KW", "ABP-2 KW", "G-22 KW", "UUC36T37", "G-23 KW", "WRM KW", "Total KWH", "Total KVAH", "ET-5 KWH", "ET-3_4 KWH", "ET-6_7 KWH", "ABP-1 KWH", "ABP-1A KWH", "ABP-2 KWH", "SMS 1 KWH", "UUC60T73", "PLC Time", "Voltage", "Current", "Load Factor", "Avg. P.F."]
Problem:
- Now in cellForRowAt indexPath of my tableView, I need "Set MD" value at indexPath 0 (need value as per the index of indexArray)
This way for each row of my tableView, I need value as per the indexArray's index.
For Example:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
(at 0th Index) cell.lblParameter.text = "Set MD" // value from paramNameArray as per indexArray's index(3)
(at 1st Index) cell.lblParameter.text = "Running MD" // value from paramNameArray as per indexArray's index(6)
// And so on...
return cell
}
Help would be much appreciated, Thanks! :)
cell.lblParameter.text = paramNameArray[indexArray[indexPath.row]]