mardi 7 avril 2015

If constraint changed (swift)

I'm trying to define an If statement for checking if the value of a constraint has changed.


if the constraint has changed { //do this }


But I'm not sure how to use DidChange for a constraint, or if that even is the correct method.


Currently I'm using the greater than or equal to Int. But That isn't the behavior I'm after. Is there a way to write an if statement for simply checking if the value has changed?





if self.myConstraint.constant >= 50 {

let delay = 0.1 * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))

dispatch_after(time, dispatch_get_main_queue(), {

var iPath = NSIndexPath(forRow: self.TheTableView.numberOfRowsInSection(1)-1, inSection: self.TheTableView.numberOfSections()-1)
self.TheTableView.scrollToRowAtIndexPath(iPath, atScrollPosition: UITableViewScrollPosition.Bottom, animated: false)

println("\(countElements(fieldStatus))")
})
}



Aucun commentaire:

Enregistrer un commentaire