Questions tagged [nsviewcontroller]

An Objective-C object that manages a view, typically loaded from a nib file.

The NSViewController object manages a view, typically loaded from a nib file.

This management includes:

  • Memory management of top-level objects similar to that of the NSWindowController class, taking the same care to prevent reference cycles when controls are bound to the nib file's owner that NSWindowController began taking in Mac OS v 10.4.
  • Declaring a generic representedObject property, to make it easy to establish bindings in the nib to an object that isn't yet known at nib-loading time or readily available to the code that's doing the nib loading.
  • Implementing the key-value binding NSEditor informal protocol, so that applications using NSViewController can easily make bound controls in the views commit or discard the changes the user is making.

For more information on the NSViewController object, check Apple's NSViewController Class Reference.

410 questions
0
votes
2 answers

How can I get notified when NSViewController instance is loaded / unloaded

On iOS, there are viewDidAppear / viewDidDisappear methods. They are also being added to Yosemite (see https://developer.apple.com/library/prerelease/mac/releasenotes/AppKit/RN-AppKit/#10_10ViewController). Question: how can I detect when my view is…
Michael Teper
  • 4,591
  • 2
  • 32
  • 49
0
votes
2 answers

Swapping with NSViewController

I am trying swapping two Views in a Windows. I am using Cocoa Framework (just for Mac) with Xcode 5.1.1 and NSViewController for get it. All compile perfectly but this doesn't works, I get the next message from compiler: "libdyld.dylib…
0
votes
1 answer

Swift OS X Xcode Beta 3 - IBAction func has no access to global variable

I have 2 NSViewController Classes. On both is a NSButton. All works fine in the first VC. Pressing the button on the first VC opens the second VC. First View Controller: import Cocoa class ViewController: NSViewController { var number:…
user2156649
  • 73
  • 1
  • 8
0
votes
1 answer

How to fix warning Autosynthesized property 'view' will use synthesized instance variable '_view', not existing instance variable 'view'

I get the following warning/error in xcode: Autosynthesized property 'view' will use synthesized instance variable '_view', not existing instance variable 'view' when I was trying to redefine/override the class of the view property on my…
waggles
  • 2,804
  • 1
  • 15
  • 16
0
votes
1 answer

Why is NSViewController not binding representedObject?

In short: I bind an NSTextField to the File's Owner (the view controller) and Model Key Path of representedObject.firstName, but editing the text field does not change the firstName. Here are more details. I have a simple program that does nothing…
Rob N
  • 15,024
  • 17
  • 92
  • 165
0
votes
1 answer

Why "add subview" not work?

I try add subview but not work. My code is: HomeViewController* homeViewController = [[HomeViewController alloc] initWithNibName:@"HomeView" bundle:nil]; NSViewController *viewController = homeViewController; [mainView addSubview: [viewController…
soulless
  • 51
  • 4
0
votes
1 answer

How to access NSViews from other classes

Before I start, I am a beginner, so please don't overwhelm me. (even-though I probably did with you sorry) :/ So basically I have 1 main view (NSView) onto which I am loading other views. So my awakeFromNib method works and it loads my start menu…
jundl77
  • 476
  • 2
  • 15
0
votes
1 answer

Passing CoreData content to a NSViewController

I've started to move to using NSViewControllers and I can't for the life of me figure out how to get content from a CoreData entity to a TableView (for example) through a NSViewController?
nanochrome
  • 707
  • 2
  • 12
  • 26
0
votes
1 answer

File owner changed when showing NSPopover

This looks really strange to me Once i add a NSPopover and it's contentVC to the Nib (file owner is set right to myVC) and right AFTER triggering [self.sliderPopover showRelativeToRect:rect ofView:sender preferredEdge:NSMinYEdge]; All mi bindings…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
0
votes
1 answer

Is it necessary to set rbl_viewController when using Rebel's RBLViewController?

As the title states, I've been wiring up the rbl_viewController outlet in my XIBs, however on a closer read of the RBLViewController API, this property does seem to get set automatically. Is it necessary to set rbl_viewController when using Rebel's…
Tony Arnold
  • 2,738
  • 1
  • 23
  • 34
0
votes
1 answer

NSView that resizes like UserDefaults, basically to fit content

I'd like a NSView to resize (larger and smaller) based on its currently viewed sub view. This is seen most often in UserDefaults but I would like it for a Modal Window. I'm using a NSTabView inside the Window with 4 tabs. Each tab have quite…
Gabe Rainbow
  • 3,658
  • 4
  • 32
  • 42
0
votes
1 answer

What is causing the compile error: Illegal NSTableView data source?

After some 'cleaning' of a working app, the main window appears as designed in the MainWindow.xib. I deleted a MainWindowViewController object in IB. (was beneath Font Manager) MainWindow.xib has it's Custom class set to…
David
  • 3,285
  • 1
  • 37
  • 54
0
votes
2 answers

How to allow loadView to be sent to my NSViewController?

Having discovered that awakeFromNib is begin called multiple times, I tried to implement loadView in the following way to prevent (nib loading) initialization from repeatedly occurring, with: - (void)loadView { [self viewWillLoad]; [super…
David
  • 3,285
  • 1
  • 37
  • 54
0
votes
1 answer

NSPopover switch view

I have a popover menulet and it's contentViewController is some NSViewController. Everything fine here. The problem that I have is that I really don't understand how to change the View. I wanna load another view, and this is what I tried: popover =…
maxus182
  • 161
  • 1
  • 1
  • 10
0
votes
0 answers

NSPopover is not working properly

I create a NSPopover programmatically like this: popViewController *controller = [[popViewController alloc] initWithNibName:@"popViewController" bundle:nil]; NSPopover *thePopover = [[NSPopover alloc] init]; [thePopover…
ozmax
  • 470
  • 6
  • 17