Setting text for uilabel collection from array

290 views Asked by At

I am having a UIScrollView with multiple UILabels inside, so I made a collection of IBOutlets and connected all the labels. Now the problem is am setting the label text from an array and the value in each label not in order as I have in the array.

let timeTables:[TimeTable]  = TimeTable.TimeTableList(array: 
 respnse.responseArray)
        print("From label count \(self.fromLabels.count)")
        print("Time tabele count \(timeTables.count)")
        for (index, item) in timeTables.enumerated() {//
            print(index)
            if index < self.fromLabels.count ,  index < 
  self.toLabels.count{
                self.fromLabels[index].text =  item.from
                print(item.from as Any)
                self.toLabels[index].text =  item.to
                print(item.to as Any)
            }
        }

How to make the label display the value in the array order?

0

There are 0 answers