Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 783
Isaiah Avatar asked Aug 11 '14 19:08

Isaiah


People also ask

What is Apple Xcode used for?

Xcode is Apple's IDE, made for producing software on Mac for use on iOS, iPadOS, macOS, tvOS, and watchOS. Free to download and use, the IDE is chiefly used by developers to create iPhone and iPad apps, as well as programs for the Mac.

What is Xcode in Mac?

Xcode is a complete developer toolset for creating apps for Mac, iPhone, iPad, Apple Watch, and Apple TV. Xcode brings user interface design, coding, testing, debugging, and submitting to the App Store into a unified workflow.

Can Xcode run on Windows?

Given that Xcode works only on macOS, a solution to get Xcode on Windows would be to install macOS on a Windows PC by means of a virtualization app such as VMware or VirtualBox. Using a virtualization platform provides users with the full functionality of Xcode on your Windows machine.

Is Xcode only for Mac?

Xcode only runs on a mac.


2 Answers

The new window style mask NSFullSizeContentViewWindowMask added in OS X 10.10 will do the trick.

self.window.titleVisibility = NSWindowTitleVisibility.Hidden; self.window.titlebarAppearsTransparent = YES; self.window.styleMask |= NSFullSizeContentViewWindowMask; 

Release Notes

like image 89
Renfei Song Avatar answered Sep 28 '22 00:09

Renfei Song


Since MacOS X 10.10, you can use these:

if #available(macOS 10.10, *) {     window.titlebarAppearsTransparent = true }  if #available(macOS 10.2, *) {     window.movableByWindowBackground  = true } 

There was an official sample project for window appearance in Yosemite. You might wanna check it out.

like image 40
Cai Avatar answered Sep 28 '22 01:09

Cai