2014-01-24 70 views
0

NSMutableParagraphStyle段落間距工作得很好。在NSMutableParagraphStyle中的多段落間距

但我使用項目符號也。

當用戶按返回(回車)然後新的段落會來。

所以當用戶類型要點的UITextView然後在兩點paragaph間距之間應該是,並在所有的段落間距的其餘部分是東西高。

我的代碼...

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; 
    paragraphStyle.minimumLineHeight = 0.f; 
    paragraphStyle.maximumLineHeight = 16.f; 
    paragraphStyle.firstLineHeadIndent = 16.0; 
    paragraphStyle.paragraphSpacing = 7.0; 
    paragraphStyle.lineSpacing = 5.0; 
    paragraphStyle.headIndent = 16.0; 
    paragraphStyle.lineBreakMode=NSLineBreakByWordWrapping; 
    paragraphStyle.tailIndent=305.0; 
    mutattstr1 = [[NSMutableAttributedString alloc] initWithAttributedString:txtViewOfNotes.attributedText]; 
    [mutattstr1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, mutattstr1.length)]; 
    [txtViewOfNotes setAttributedText:mutattstr1]; 

如在此文本視圖我需要給小空間中的要點線之間徘徊。

enter image description here

那麼,如何讓多個行距或段落間距或應用程序與此相關的任何其他事情。

任何一種聯繫,想法,代碼,船塢歡迎...

回答

0

您可以通過使用範圍屬性必須在一個NSAttributedStringsNSMutableParagraphStyle - 就像你已經做了。

你只需要檢測你想要的每個NSMutableParagraphStyle並適用於各種NSRange。這是「有趣」的一部分。

+0

ya這是真的,但是當用戶鍵入一個段落,並且如果新段落將帶有圓點(意味着從左側有更多空間),那麼它會波動,並且在刪除文本時,文本也會波動。如果你解決這個問題,那麼問題就沒有了 – Sam