ios - Calling setAttributedText on UITextView resets the font size, and I can't figure out why -


i've read this annoying bug on stackoverflow, if don't make uitextview selectable, setting text cause font reset, super annoying.

this seems work when setting normal text, not attributedtext, because when set attributedtext still resets font, if have text view set selectable.

this easy replicate. create text view in storyboard instance (how i'm doing it), set font, set attributed text plain string mytextview.attributedtext = nsattributedstring(string: "lorem ipsum dolor.") , gets reset.

how stop this? it's super annoying.

i had same issue , solved pragmatism i'm sure it's bug in ios. so, take might not best solution 1 that'll work. write category uitextview method -(void)setattributedtextwithoutresettingfont:(nsattributedstring *)attributedtext; , implement such first save current font in temporary variable, call actual setter setattributedtext: on uitextview , update font again 1 saved in temporary variable.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -