0

我正在 Xcode 上制作一个文本编辑器,但我需要知道如何更改文本视图中的选项卡大小,因为默认情况下它是 8,但我希望它是 4。有没有办法做到这一点?

4

1 回答 1

0

根据这个 SO 线程

你需要在你的NSTextViewDelegate对象中实现它。

- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)commandSelector 
{
    if (commandSelector == @selector(insertTab:)) 
    {
        [aTextView insertText:@"        "]; //this is 8 spaces
        return YES;
    }
    return NO;
}
于 2016-01-31T00:51:22.267 回答