NSTextView - 新线后NSParagraphStyle丢失

时间:2013-10-06 06:52:41

标签: objective-c cocoa nstextview

我用

更改了NSTextView的NSAttributedString - 属性
- (void)textStorageDidProcessEditing:(NSNotification *)notification {

    NSMutableParagraphStyle * myParagraphStyle = [[NSMutableParagraphStyle alloc] init];
    myParagraphStyle.lineSpacing = 10;

    NSRange range = NSMakeRange(0,self.string.length);

    [[self textStorage] addAttribute:NSParagraphStyleAttributeName
                               value:myParagraphStyle
                               range:range];
}

- (void)insertNewline:(id)sender当我跳回到这条线时,插入符号的大小更大。插入符号包括行间距,而不仅仅是字体高度。

enter image description here

跳回来

enter image description here

在进入换行符之后感觉就像我在不同的环境中。键入时字体大小本身是相同的,但插入符号较大,当然也是选择区域。

0 个答案:

没有答案