0

I need to detect changes to my UILabel. In my code i have in array which is getting updated via Socket IO. But the changes only appear when i scroll. I need that when the array changes, the label get updated directly. How can i get this working?

in cellForRowAtIndexPath:

 cell.currentPrice.text =   String(self.currentPriceArray[indexPath.row]) // and this array get updated via Socket IO

In my viewDidLoad i have something like this

 override func viewDidLoad() {


    socket.connect()
    getVeilingen(offset,limit:limit) // method thay updates the array
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

I need an observer for this, but with the code what i found i cannot figure it out.. For example, this doesn't solve my problem (Overriding the UILabel, it give's me weird errors)

override var text: String? {
    didSet {
        if let text = text {
            println("Text changed.")
        } else {
            println("Text not changed.")
        }
    }
}

How can i fix this? Thanks

ypnos
  • 50,202
  • 14
  • 95
  • 141
erwinnandpersad
  • 376
  • 5
  • 16

0 Answers0