Skip to content

Instantly share code, notes, and snippets.

@TJRoger
Created October 14, 2015 09:47
Show Gist options
  • Save TJRoger/d4aca36e669dd205f236 to your computer and use it in GitHub Desktop.
Save TJRoger/d4aca36e669dd205f236 to your computer and use it in GitHub Desktop.
show text from the top of UITextView in iOS 9
var workaroundIOS9Bug: Bool = true
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 9.0, *) {
self.workaroundIOS9Bug = true
}else {
self.workaroundIOS9Bug = false
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if self.workaroundIOS9Bug {
self.commonSenseTextView.contentOffset = CGPointZero
self.workaroundIOS9Bug = false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment