Skip to content

Commit

Permalink
Merge pull request #108 from AntonPalich/Fix_iOS_8_Crash
Browse files Browse the repository at this point in the history
Fixed iOS 8 crash
  • Loading branch information
AntonPalich committed Apr 15, 2016
2 parents 9bccd77 + 2e4812a commit a95e971
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,19 @@ class KeyboardTracker {
return max(0, self.view.bounds.height - trackingViewRect.maxY)
}

var ios8WorkaroundIsInProgress = false
func layoutTrackingViewIfNeeded() {
guard self.isTracking && self.keyboardStatus == .Shown else { return }
self.adjustTrackingViewSizeIfNeeded()
if #available(iOS 9, *) {
// Working fine on iOS 9
} else {
// Workaround for iOS 8
guard !self.ios8WorkaroundIsInProgress else { return }
self.ios8WorkaroundIsInProgress = true
self.trackingView.window?.setNeedsLayout()
self.trackingView.window?.layoutIfNeeded()
self.ios8WorkaroundIsInProgress = false
}
}

Expand Down

0 comments on commit a95e971

Please sign in to comment.