Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Senor Cuete

macrumors 6502
Original poster
Nov 9, 2011
439
32
I am working on a Mac application that was developed in Objective C and Interface builder. In earlier versions of MacOS the title of a window was centered. Now it's left-justified. Is there any way to center it? I can't see a setting for this in Interface builder. Reading the developer documentation, I can't can't see how to do this programmatically. Is this possible?
 
I’m away from my Mac right now so can’t investigate further but I am guessing you’re on macOS Tahoe and working in Xcode 26, building against the Tahoe sdk. I believe you will get a center justified title if you build against an older sdk. Left justification is part of the new default look and feel in Tahoe
 
Yes, Tahoe and XCode 26. Generally you have a lot of power to customize the appearance of your GUI, but maybe not in this case. Tahoe is butt ugly - a real disappointment.
 
It's a change in the behaviour of default title views. You can always make a Toolbar/Titlebar with custom views instead of you prefer, but in Tahoe the default for window titles is to be left aligned
 
I looked into this some more. This is cast in stone in Tahoe. In order to use special characters or justification in your window title you have to create a Title bar. This seems like a lot of hassle to work around inflexible requirements to use the latest cartoonish GUI.
 
I looked into this some more. This is cast in stone in Tahoe. In order to use special characters or justification in your window title you have to create a Title bar. This seems like a lot of hassle to work around inflexible requirements to use the latest cartoonish GUI.
I don't know, mate. The flexibility is there to do custom views, but the easy components are consistent with the system UI. That makes sense
 
According to the developer documentation you should create an NSTitlebarAccessoryViewController and then set the layoutAttribute property to:

The default value of this property is NSLayoutAttributeBottom, which means that the accessory view should display below the title bar. You can also set this property to NSLayoutAttributeRight or (in apps linked on macOS 10.11 or later) NSLayoutAttributeLeft. All other values are invalid and will cause an assertion to be raised.

BELOW, LEFT or RIGHT of the title bar but NOT over it. So can you really replace it with a title that can be justified or display special characters? According to the documentation you might be able to set the titleVisibility to windowTitleHidden and then set the layoutAttribute to NSLayoutAttributeRight. Has anyone actually done this?
 
Last edited:
According to the developer documentation you should create an NSTitlebarAccessoryViewController and then set the layoutAttribute property to:

The default value of this property is NSLayoutAttributeBottom, which means that the accessory view should display below the title bar. You can also set this property to NSLayoutAttributeRight or (in apps linked on macOS 10.11 or later) NSLayoutAttributeLeft. All other values are invalid and will cause an assertion to be raised.

BELOW, LEFT or RIGHT of the title bar but NOT over it. So can you really replace it with a title that can be justified or display special characters? According to the documentation you might be able to set the titleVisibility to windowTitleHidden and then set the layoutAttribute to NSLayoutAttributeRight. Has anyone actually done this?
Yes, you can hide the title with setTitleVisibility: NSWindowTitleHidden.

Now I'll create a title bar Accessory view. More news soon...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.