Skip to content

Commit

Permalink
Fixed iOS 8 crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Schukin committed Apr 15, 2016
1 parent 9bccd77 commit 2e4812a
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 2e4812a

Please sign in to comment.