настройка межстрочного интервала в UITextView - PullRequest
2 голосов
/ 15 июня 2011

есть ли способ в приложении iphone, чтобы настроить межстрочный интервал между строками в UITextview.

Заранее спасибо.

Ответы [ 2 ]

0 голосов
/ 01 марта 2013
       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];
0 голосов
/ 20 июля 2011

Это прекрасно работает для меня:

#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;
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...