Objective C - UITextView letter spacing and vertical spacing
How can I set the letter spacing and vertical spacing for a UIT开发者_运维技巧extView?
Trying to do it from nib if possible but if not, is there a property I can set through code?Thank you,
TeeThere is no property within the UITextView to explicitly set the letter spacing, or vertical spacing - with the native controls it can't be done.
If you want to do this you're going to have to roll your own. There's a SO thread about changing the UILabel/UIFont letter spacing which ought to provide you with a direction to go in.
With that said, I have to ask the question why you want to do this? Apple is very specific about it's interface elements, and my thought is that tweaking a UITextView is going to be very off putting to your users.
As gavin has said, really; if possible you could change to a UILabel and set the lineBreakMode property, in conjunction with the contentSize property of the label's frame to partly achieve some light modification.
You could also replace spaces with a number of spaces for example from a string object, but again as has been said, I wouldn't advise tampering too far with this, especially if its going to be a public appstore project.
Good luck!
Well if you are looking for line height you can get like this.
yourUITextView.font.lineHeight
This would give you line height according to the current font size. This works perfectly in iOS 8. Not sure about backward compatibility.
精彩评论