How to change the size of a Text View in Xcode?

74 Views Asked by At

I'm making a text editor on Xcode, but I need to know how to change the tab size in a Text View because it's at 8 by default, but I'd like it at 4. Is there any way to do this?

1

There are 1 best solutions below

0
On

as per this SO thread:

You need to implement this in your NSTextViewDelegate object.

- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)commandSelector 
{
    if (commandSelector == @selector(insertTab:)) 
    {
        [aTextView insertText:@"        "]; //this is 8 spaces
        return YES;
    }
    return NO;
}