Search code examples
xcodeswiftmacosscrollview

How to enable horizontal scrolling of text in NStextView window for OSX application?


I have spent quite a time with Xcode without a solution, I miss in Xcode a simple feature for OSX application. When I past or type text in the NStextView window, this text should be continued on the right and I can scroll horizontally. Instead now, the text go on the next line and I have only vertical scrolling. What I have to do in xcode setting to have horizontal scrolling without jumping on the line below?


Solution

  • I only have the Objective-C:

    [self.scrollView setHasHorizontalScroller:YES]; 
    [self.textView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
    [self.textView setHorizontallyResizable:YES];
    [[self.textView textContainer] setWidthTracksTextView:NO];
    [[self.textView textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];