Search code examples
macoscocoansoutlineview

NSOutlineView support for RTL (right to left layout)


How do you support RTL mode in NSOutlineview? Specifically I would like the disclosure triangle button to be on the right and the text to be right aligned with indentation starting from right.

Now, I see this behaviour in the Finder app when I switch to RTL language. But I can't get it to work in my app. I am looking to support 10.10+.

Currently, running the app in RTL layout makes the outline view cell texts become right aligned but the disclosure triangles remain on the left. I am using view based outline view.


Solution

  • As pointed out by Willeke in his comment, the solution was to programatically set the userInterfaceLayoutDirection of my NSOutlineView.

    self.outLineView.userInterfaceLayoutDirection = NSUserInterfaceLayoutDirectionRightToLeft;