Questions tagged [nswindow]

an apple class that defines objects that manage and coordinate the windows an application displays on the screen

The NSWindow class defines objects (known as windows) that manage and coordinate the windows an application displays on the screen. A single NSWindow object corresponds to at most one onscreen window. The two principal functions of a window are to provide an area in which views can be placed and to accept and distribute, to the appropriate views, events the user instigates through actions with the mouse and keyboard.

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html

1332 questions
75
votes
5 answers

How do I create a Cocoa window programmatically?

My Cocoa app needs some small dynamically generated windows. How can I programmatically create Cocoa windows at runtime? This is my non-working attempt so far. I see no result whatsoever. NSRect frame = NSMakeRect(0, 0, 200, 200); NSUInteger…
Steve McLeod
  • 51,737
  • 47
  • 128
  • 184
56
votes
2 answers

NSWindow with NSWindowCollectionBehaviorStationary is visible on the Dashboard. Is this a bug?

I'm trying to get my NSWindow to: Be visible on all Spaces Be visible when showing the Desktop (by pressing F11) Not be visible in Mission Control/Expose The following does exactly that, but with a side effect: [self setCollectionBehavior:…
Mark
  • 6,647
  • 1
  • 45
  • 88
53
votes
2 answers

Unlocking Focus on wrong view ((null)) under OS X 10.7.2

I have a Cocoa app that has an NSWindowController controlling an NSWindow with an NSComboBox in it. Nothing special, and it worked fine until upgrading to OS X 10.7.2. Now I get the following exception, which occurs only once, when the window…
alexantd
  • 3,543
  • 3
  • 27
  • 41
40
votes
4 answers

Keep window always on top?

In Objective-C for Cocoa Apps it's possible to use such way to keep window always on top? How to achieve the same with Swift? self.view.window?.level = NSFloatingWindowLevel Causes build error Use of unresolved identifier 'NSFloatingWindowLevel'
AlexKorovyansky
  • 4,873
  • 5
  • 37
  • 48
32
votes
11 answers

NSWindow with round corners and shadow

I'm trying to crate a NSWindow without title bar (NSBorderlessWindowMask) with round corners and a shadow, similar to the below "Welcome to Xcode" window. I make a subclass of NSWindow: @implementation FlatWindow -…
dhrm
  • 14,335
  • 34
  • 117
  • 183
31
votes
4 answers

Unknown Window class (null) in Interface Builder file, creating generic Window instead

My app uses storyboards and the windows have to use a custom class, MyWindow for example, or at runtime/launching the app, there is an error message saying: Unknown Window class (null) in Interface Builder file, creating generic Window instead I…
LShi
  • 1,500
  • 16
  • 29
28
votes
4 answers

Hide buttons from titlebar in Cocoa

The Apples Human Interface Guidelines say: macOS Human Interface Guidelines: Panels How do I make the very first titlebar in that image (with only a close button). Disabling both Resize and Minimize in IB only make the resize/minimize buttons get…
user142019
27
votes
2 answers

How to create modal slide-out window in Mac OS?

How can I create modal slide-out window/view "in-window" in Xcode like in these screenshot? I've tried create new Window controller with "Authentication panel style" animation but then I'm receiving only Xcode crashes.
Vasily
  • 3,740
  • 3
  • 27
  • 61
26
votes
2 answers

Why isn't my sheet attached to the window it's run for?

I have a NIB which contains two windows, one is the app's main window visible at launch and the other is a custom sheet (and therefore not visible at launch). When the sheet is required my controller calls: [NSApp beginSheet: sheetWindow…
user23743
26
votes
6 answers

How to make a smooth, rounded, volume-like OS X window with NSVisualEffectView?

I'm currently trying to make a window that looks like the Volume OS X window: To make this, I have my own NSWindow (using a custom subclass), which is transparent/titlebar-less/shadow-less, that has a NSVisualEffectView inside its contentView.…
Pedro Vieira
  • 3,330
  • 3
  • 41
  • 76
25
votes
9 answers

Hide NSWindow title bar

Is there a way to hide the titlebar in an NSWindow? I don't want to have to completely write a new custom window. I can't use NSBorderlessWindowMask because I have a bottom bar on my window, and using NSBorderlessWindowMask makes that disappear. I…
indragie
  • 18,002
  • 16
  • 95
  • 164
24
votes
6 answers

Set NSWindow Size programmatically

How can I set the window size programmatically? I have a window in IB and I want to set the size of it in my code to make it larger.
atomikpanda
  • 1,845
  • 5
  • 33
  • 47
21
votes
3 answers

How to Change Color of NSWindow Title Bar in OSX

After a Long search regarding the NSWindow title bar color and title color, i have found a easy drawing solution. I posting this to share my knowledge.
Muruganandham K
  • 5,271
  • 5
  • 34
  • 62
21
votes
4 answers

Save NSWindow Size on Resize & Close For User

I've noticed that all applications on OS X seem to save the size you set it at. The next time you open it it's typically in the same position and size. I'm making an app and I've noticed that after resizing, if I launch the application again it's…
aroooo
  • 4,726
  • 8
  • 47
  • 81
20
votes
9 answers

Allow click and dragging a view to drag the window itself?

I'm using a textured window that has a tab bar along the top of it, just below the title bar. I've used -setContentBorderThickness:forEdge: on the window to make the gradient look right, and to make sure sheets slide out from the right…
d11wtq
  • 34,788
  • 19
  • 120
  • 195
1
2 3
88 89