NOTE: The time when I asked this question was when Apple just released iOS 7. Apple reimplemented UITextView
with Text Kit
after iOS 7. UITextView
had some bugs that time. The issue of this question was one of them. But now it's fixed.
There is a UITextView
in my app which is configured in IB. The text view has some default text of which the font size is 60.0f
. The text view uses plain string to render text. If I change the text property of the text view programmatically when the app is running:
self.textView.text = @"some text different from default text";
the text view will change the font back to the default font.
configure font programmatically can solve this problem:
self.textView.font = [UIFont systemFontOfSize:60.0f];
This is a bug of the new UITextView
.
hello , stackoverflow
Hello, stackoverflow
has font size 18 which you set by the code and its correct. andHello World
has font size 60 which is set in the interface builder. So do you want the font size of your text view 60 or 18?