2
A
回答
-1
這完美的作品對我來說:
#define MAX_HEIGHT 2000
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:14]
constrainedToSize:CGSizeMake(100, MAX_HEIGHT)
lineBreakMode:UILineBreakModeWordWrap];
[textview setFont:[UIFont systemFontOfSize:14]];
[textview setFrame:CGRectMake(45, 6, 100, size.height + 10)];
textview.text = text;
+0
太棒了,謝謝,儘管幾個月後.. – 2012-02-28 04:16:32
+3
這實際上並沒有回答被問到的問題。 – 2013-01-09 19:22:19
0
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineHeightMultiple = 50.0f;
paragraphStyle.maximumLineHeight = 50.0f;
paragraphStyle.minimumLineHeight = 50.0f;
NSString *string = @"if you want reduce or increase space between lines in uitextview ,you can do this with this,but donot set font on this paragraph , set this on uitextveiw.";
NSDictionary *ats = @{
NSParagraphStyleAttributeName : paragraphStyle,
};
[textview setFont:[uifont fontwithname:@"Arial" size:20.0f]];
textview.attributedText = [[NSAttributedString alloc] initWithString:string attributes:ats];
相關問題
- 1. UILabel:調整邊距以匹配UITextView
- 2. HTML調整間距
- 3. 動態調整大小的越野車邊距行爲UITextView
- 4. 在iOS 7中調整字母間距
- 5. jsPDF調整文本行間距
- 6. 在UIView UITextView不調整
- 7. 調整表之間的間距,以html
- 8. 在UITableViewCell中調整UITextView的尺寸
- 9. 在UITextView中調整文本大小
- 10. 在UITextView中調整字體大小
- 11. 調整R控制檯中的行之間的差距
- 12. IPhone:更改UITextView中的行距?
- 13. 在UITextView iOS 7上減少行距
- 14. 調整距離
- 15. 有沒有辦法改變UIStackView中UITextView的行間距/邊距/填充?
- 16. UICollectionView項間距無法調整
- 17. 調整TEXT以適應UITextView
- 18. 無法調整大小UITextView
- 19. UITextView的不正確調整
- 20. 的UITextView不會調整
- 21. 構建用於調整字體中字符間距和間距的軟件
- 22. 如何調整工具欄中元素之間的間距?
- 23. 如何調整列表視圖中圖像間的間距
- 24. 調整文字之間的間距在水平傳說
- 25. 可以在html/css中調整定義列表的間距嗎?
- 26. 在jsp中調整兩個位置之間的距離
- 27. 如何在JavaFX中調整字母間距
- 28. 在一張圖中調整不同圖之間的邊距
- 29. 在R圖中調整x軸與文本之間的距離
- 30. 在UITextView和UIButton之間添加垂直間距?
[在UITextView中設置行高(可能重複http://stackoverflow.com/questions/3760924/set-line-height-in- uitextview) – 2011-06-15 11:39:02