Am adding an image to a NSAttributedString
object so I can display them properly in a UITextView
. So far, it works great. Only problem is, my Font size is 25 to match my image size but each time I add an image to the UITextView
, the Font resets to some smaller size. I need to keep the font at 25 to match texts with the image size.
NSAttributedString
has 3 constructors which take string
, attributedString
and string:attributes:
.
Since I'm not using string, I can't set the attributes using the third constructor and the first 2 won't allow me to set attributes ( UIFont
). I therefore decided to set the Font size from Interface Builder
and reset it each time I add an image to the `UITextField.
Am facing a problem here because each time I reset the font, the UITextView
scrolls to the first line (assuming there is so much text, it has scrolled up). How do I set font size after adding image without the UITextView
scrolling up automatically? Better still, is there a better way of doing this? Thanks.
NSMutableAttributed字符串可以尝试一些方法,包括在构造属性字符串之后跨范围设置属性。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.