I\'m using storyboards for my UI. I was previously using XCode 4.6 and released on iOS 6. I have since updated to iOS 7 using XCode 5 and updated the Storyboard to work nice
For me it's work if you set the text of your UITextView and after set the font (same for color) :
_myTextView.text = @"text";
[_myTextView setFont:[UIFont fontWithName:@"Helvetica Neue" size:18.0f]];
_myTextView.textColor = [UIColor whiteColor];
As mentioned by others:
textView.font = UIFont.systemFont(ofSize: 16)
textView.isEditable = false
p.s. no need to first set isEditable
as true
since it's true
by default: a little shorter, a little nicer
Thank you for all the answers guys. Issue is still present on iOS9. What i've found out, is that when you set "User Interaction Enabled = false" in the Interface Builder you can leave Editable and Selectable = true and user will not be able to edit a text view.
So, my solution is:
I found the font size was being ignored. This was resolved by ticking the checkbox called: Selectable (having selected the UITextView within the storyboard)
In my case, I solved by setting the new font in "viewDidLayoutSubviews".
In my case, it is matter of 'selectable' property of UITextView.
So I checked 'selectable' property of UITextView in Storyboard Editor to set it YES
and later in viewWillAppear set this property to NO.
textview.text = @"some text";
textview.selectable = NO;