Skip to content

Instantly share code, notes, and snippets.

@troyharris
Created August 17, 2013 15:06
Show Gist options
  • Save troyharris/6257332 to your computer and use it in GitHub Desktop.
Save troyharris/6257332 to your computer and use it in GitHub Desktop.
iOS 7 fix for invisible UITextView text
/* Sometimes in iOS 7, a UITextView will be invisible until the user starts editing it or
the keyboard appears. Adding this somewhere after setup will fix this issue (either viewDidLoad or viewDidLayoutSubviews)
*/
[self.textView.layoutManager ensureLayoutForTextContainer:self.textView.textContainer];
@mspensieri
Copy link

Fantastic. Thank you!

@AdrianBinDC
Copy link

I've got a couple of UITextViews inside of a UIStackView of a Swift 3 project in Xcode 8. That line in viewDidLayoutSubviews & viewDidLoad didn't seem to do anything.

@lteu
Copy link

lteu commented May 31, 2018

Me either, in viewDidLoad it does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment