Search code examples
swiftcocoainterface-builderosx-yosemitetitlebar

Xcode & Swift - Window without title bar but with close, minimize and resize buttons


I am currently using Swift in Xcode 6, Beta 5. I am trying to remove the title bar, or any visible difference between the title bar and the actual content. If I enable "Unified title and toolbar" in the Attributes Inspector on a Window, nothing visibly happens. I have already left the title out.
When no title is entered, the title bar will still be distinguishable because of the border line and background difference with the rest of the window, separating it from the actual content.


An excellent example would be the current Yosemite, OS X 10.10, Notes app. No title bar is visible or distinguishable, just the Close, Minimise and Resize buttons as seen here. Screenshot of Notes window

I have searched and visited other posts, but to no to little avail.
Those mentioned hiding the title bar altogether, but I wouldn't know how to manually re-add the Close, Minimise and Resize buttons properly, meaning they would look correct, no actual, sneaky image replacements and connections with the menu bar Close, Minimise and Resize functions.


Solution

  • If you are using storyboard, it's just a simple check box in the Inspector bar.

    1. Select the window from Story Board enter image description here

    2. Check the Transparent Title Bar checkbox in the inspector window.

    enter image description here

    Here's how it looks like in the Story board. It looks the same when you build and run the application.

    enter image description here