nswindowcontroller

New NSWindow from application - mission impossible?

馋奶兔 提交于 2019-12-02 10:07:00
OK, what am I doing wrong? 1. Created cocoa app and appDelegate named: window2AppDelegate 2. window2AppDelegate.h #import "PrefWindowController.h" @interface window2AppDelegate : NSObject <NSApplicationDelegate> { NSWindow *window; PrefWindowController * ctrl; } @property (assign) IBOutlet NSWindow *window; - (IBAction) buttonClick:(id)sender; - (IBAction) buttonCloseClick:(id)sender; @end 3. in xib editor, window connected to window controller - set to appdelegate, buttonclick actions to buttons 4, created #import <Cocoa/Cocoa.h> @interface PrefWindowController : NSWindowController { @private

NSTableView with plist file

烂漫一生 提交于 2019-12-02 06:44:02
问题 I am very new to mac app development. so just doing some practical exercise. I want to create a tableview which display data from my plist file. I have one windowcontroller class and window controller.xib file. I drag and drop NSTableView to the .xib file. and using this code to load plist file - (void)windowDidLoad { [super windowDidLoad]; NSBundle *bundle = [NSBundle mainBundle]; NSString *path = [bundle pathForResource:@"tenth" ofType:@"plist"]; file = [[NSArray alloc]

How to change the NSScreen a NSWindow appears on

萝らか妹 提交于 2019-11-30 23:38:49
I have an application that will load a couple of windows depending on which button is pressed. All except one of these open on the mainScreen (the screen in which the main window is open in). One of them (the preference window) opens on the first screen (the screen with the menu bar). I cannot understand way it is doing this, is there a way to change the screen that a NSWindow opens on? I could not get toohtik's answer to work. What I ended up doing was subclassing NSWindow and then overriding constrainFrameRect: toScreen:. This will automatically open the new window on the "main screen" of

How to change the NSScreen a NSWindow appears on

安稳与你 提交于 2019-11-30 18:40:06
问题 I have an application that will load a couple of windows depending on which button is pressed. All except one of these open on the mainScreen (the screen in which the main window is open in). One of them (the preference window) opens on the first screen (the screen with the menu bar). I cannot understand way it is doing this, is there a way to change the screen that a NSWindow opens on? 回答1: I could not get toohtik's answer to work. What I ended up doing was subclassing NSWindow and then

How to use NSViewController in an NSDocument-based Cocoa app

╄→гoц情女王★ 提交于 2019-11-30 12:19:52
问题 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 template was updated to use NSViewController, so I am not clear on how exactly I should organize my application. The template creates a storyboard with an NSWindow, NSViewController. My understanding is that I should probably subclass

How to use NSViewController in an NSDocument-based Cocoa app

故事扮演 提交于 2019-11-30 02:29:06
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 template was updated to use NSViewController, so I am not clear on how exactly I should organize my application. The template creates a storyboard with an NSWindow, NSViewController. My understanding is that I should probably subclass NSWindowController or NSWindow to have a reference to my model object, and set that in makeWindowControllers(). But

NSWindowController windowDidLoad not called

强颜欢笑 提交于 2019-11-28 20:50:43
I have a simple Cocoa app using a NSWindowController subclass. In the nib I have set: File Owner's class to my NSWindowController subclass The 'Window' outlet of the File's Owner to the main NSWindow in the nib. The init method of my NSWindowController subclass is called (I call super), but not matter what I do windowDidLoad is never called. I must be missing something obvious, but for the life of me I can't figure out what it is. You're trying to create the instance of NSWindowController by instantiating it in another nib. However, when you instantiate an object in a nib file, it is

NSWindowController clarification of understanding

廉价感情. 提交于 2019-11-28 15:31:51
I have used NSWindowController in projects several times, and feel like I have a (very)rough grasp of the concepts behind this important class. What I would like to do with this post is to clarify/correct my own understandings, and hopefully help other learners get that first step into understanding. It's the at-a-glance concepts, overview, and best practices that I find is most useful, and often lacking in the documentation. Here is my take on NSWindowController (questions are interspersed in bold): An NSWindowController (NSWC) subclass exists (conceptually) just beneath every window nib,

NSWindowController windowDidLoad not called

a 夏天 提交于 2019-11-27 13:15:07
问题 I have a simple Cocoa app using a NSWindowController subclass. In the nib I have set: File Owner's class to my NSWindowController subclass The 'Window' outlet of the File's Owner to the main NSWindow in the nib. The init method of my NSWindowController subclass is called (I call super), but not matter what I do windowDidLoad is never called. I must be missing something obvious, but for the life of me I can't figure out what it is. 回答1: You're trying to create the instance of

NSWindowController clarification of understanding

时间秒杀一切 提交于 2019-11-27 09:16:00
问题 I have used NSWindowController in projects several times, and feel like I have a (very)rough grasp of the concepts behind this important class. What I would like to do with this post is to clarify/correct my own understandings, and hopefully help other learners get that first step into understanding. It's the at-a-glance concepts, overview, and best practices that I find is most useful, and often lacking in the documentation. Here is my take on NSWindowController (questions are interspersed