Questions tagged [nswindowcontroller]

A NSWindowController object manages a window, usually a window stored in a xib file.

The management of a NSWindowController entails:

  • Loading and displaying the window
  • Closing the window when appropriate
  • Customizing the window’s title
  • Storing the window’s frame (size and location) in the defaults database
  • Cascading the window in relation to other document windows of the application

A window controller can manage a window by itself or as a role player in the Application Kit’s document-based architecture, which also includes NSDocument and NSDocumentController objects. In this architecture, a window controller is created and managed by a “document” (an instance of an NSDocument subclass) and, in turn, keeps a reference to the document.

372 questions
9
votes
2 answers

NSWindowController and NSViewController

Probably a pretty simple question, but I can't get my head around it. I would like to create some sort of wizard: An NSWindow appears as a sheet from another NSWindow and should show three different NSViews one after another. I think I should create…
fabian789
  • 8,348
  • 4
  • 45
  • 91
9
votes
2 answers

OS X Menubar application: How to bring window to front

I am developing a menubar-only application for OS X and I am struggeling to get a settings window to show up in front of other apps. App setup "Menubar-only application" means: I removed the "Is Initial Controller" from the NSWindowController in…
BlackWolf
  • 5,239
  • 5
  • 33
  • 60
9
votes
5 answers

Cocoa Storyboard Responder Chain

Storyboards for Cocoa apps seems like a great solution as I prefer the methodology you find in iOS. However, while breaking things up into separate view controllers makes a lot of logical sense, I'm not clear as to how to pass window control…
Matt Long
  • 24,438
  • 4
  • 73
  • 99
9
votes
3 answers

Overriding "Edited" in window title for NSDocument

How do I prevent a window title from displaying "Edited" for an NSDocument which is dirty? I'm managing saving and autosaving myself, using a web service, and just don't want the distraction in the title bar. I've tried overriding: NSDocument's…
paulmelnikow
  • 16,895
  • 8
  • 63
  • 114
9
votes
1 answer

(Cocoa) What's the equivalent of a UIViewController subclass in a single window cocoa app?

After messing around with iOS apps, I thought I'd give a Cocoa app a whirl assuming things would be very similar. So I have a single window app with a split view and some NSTableViews (think iTunes) and I'm looking for a place to put my code that…
TijuanaKez
  • 1,472
  • 3
  • 20
  • 28
8
votes
1 answer

Why the view controller not follow the window controller's appearance in segue "Modal"?

there is a window controller connected to the view controller when the menu item click I want to show that window as modal after that the window is show, but I found that the view controller not follow the window controller's appearance also any…
chanjianyi
  • 607
  • 4
  • 15
  • 35
8
votes
3 answers

How to use NSViewController in an NSDocument-based Cocoa app

I've got plenty of experience with iOS, but Cocoa has me a bit confused. I read through several Apple docs on Cocoa but there are still details that I could not find anywhere. It seems the documentation was written before the NSDocument-based Xcode…
7
votes
2 answers

Center window in screen

Is there any way to center a window in the center of the screen in OSX? I am using the code below but it changes just the size but not the position on screen. override func viewDidLoad() { super.viewDidLoad() let ScreenStart =…
SNos
  • 3,430
  • 5
  • 42
  • 92
7
votes
2 answers

NSWindow beginSheet completionHandler not called

I am showing a sheet within my main window. I present the sheet using this code: AddContactWindowController *addContact = [[AddContactWindowController alloc] initWithWindowNibName:@"AddContactWindow"]; addContact.currentViewController =…
Z S
  • 7,039
  • 12
  • 53
  • 105
7
votes
3 answers

Is it possible to have a custom NSWindowController on launch?

In this answer is said it is possible to have a custom NSWindowController by removing the window from MainMenu.xib and instantiating the window controller 'manually' from applicationDidFinishLaunching:. But it also says: To stop the default window…
11684
  • 7,356
  • 12
  • 48
  • 71
6
votes
2 answers

How to Display and Manage a Simple Application-Modal Dialog in Cocoa

I am not sure I am doing things the right way, or if I have it all hacked up. I have a really simple test application (not document-based) I created for learning how to work with application-modal dialogs in Cocoa applications. With the application…
GTAE86
  • 1,780
  • 3
  • 29
  • 39
6
votes
1 answer

Connect Window Controller Outlet to Window

I am trying to create a simple modal dialog in XCode 4. I have created the xib, created the NSWindowController derived class and made it the class in the File's Owner of the xib. The part I am having trouble with is physically connecting the window…
GTAE86
  • 1,780
  • 3
  • 29
  • 39
6
votes
3 answers

How to get notified when NSWindow opens?

How to take notice when an NSWindow is about to be opened or have just opened? That is, the opposite of windowWillClose: delegate method (likewise the opposite of NSWindowWillCloseNotification.) This is related to this question, but from the other…
adib
  • 8,285
  • 6
  • 52
  • 91
5
votes
2 answers

Release a NSWindowController when the window is closed

I'm building a Cocoa application and have a question about using window controllers. The idea is that if the user selects New from the menu bar, an instance of MyWindowController which is a subclass of NSWindowController is created and a new window…
5
votes
1 answer

Mac OS X Cocoa single window application architecture

I cannot understand how to design an application in optimal way for a single window application to work in Mac OS X. I would prefer a single document - single window application (I'm not coding a utility application), but it is not clear where…
1
2
3
24 25