objective-ccocoanstextview

Is there any way to flip an NSRulerView?


So i've been working with an NSRulerView, displaying line numbers. I'm currently in the process of displaying NoodleLineNumberView, however, when I display the line numbers and NSTextView, they're upside down.

The cursor continues to move down as the numbers rise up

Also, when I display this code:

if(lineNumberView.flipped == YES)
{
    NSLog(@"NSRulerView is flipped");
}

"NSRulerView is flipped" is logged.

Does anybody have a solution to my problem? Ask any questions if needed so.

This is the link to the NoodleLineNumberView code


Solution

  • I just figured out the answer, and I'm surprised that this isn't anywhere else. In order to flip the direction, add this to your NSRulerView subclass.

    - (BOOL)isFlipped 
    {
        return YES; // or NO depending on direction.
    }