Created
October 14, 2015 09:47
-
-
Save TJRoger/d4aca36e669dd205f236 to your computer and use it in GitHub Desktop.
show text from the top of UITextView in iOS 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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