Skip to content

Commit

Permalink
Merge pull request #6 from Skyscanner/Fix-crash-performSelector-after…
Browse files Browse the repository at this point in the history
…Delay

Fix crashing bug when switching from focused to not focused
  • Loading branch information
gergelyorosz committed Feb 13, 2016
2 parents eee6c7c + abca7d2 commit 794c5a4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ public class SkyFloatingLabelTextField: UIControl, UITextFieldDelegate {
self.updateLineView()
} else {
// Performing fading out after a short timeout to make sure the title previously faded in all the way
self.performSelector("fadeOutHighlighted", withObject: self, afterDelay: self.titleFadeInDuration)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(self.titleFadeInDuration * Double(NSEC_PER_SEC)))
dispatch_after(time, dispatch_get_main_queue(), { () -> Void in
self.fadeOutHighlighted()
})
}
}
}
Expand Down

0 comments on commit 794c5a4

Please sign in to comment.