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
1 answer

NSView not removing from superview

I have an NSView (we'll call it view1) that is from an NSViewController. The Super view (which we'll call view2) is located inside an NSWindowController. The problem is, I can add view1 to view2, but I can't remove it.
Matt S.
  • 13,305
  • 15
  • 73
  • 129
0
votes
1 answer

Init NSViewController without nib

https://stackoverflow.com/a/28334583/4107801 I tried the method mentioned in this answer but it crashes with bad access every time. Maybe the private APIs have changed or I'm simply implementing it incorrectly. Here is my implementation: override…
Jacky Wang
  • 618
  • 7
  • 27
0
votes
1 answer

How to get reference to parent view controller in Cocoa?

I know in CocoaTouch there is the parentViewController property for this but there seems to no such property in Cocoa for OSX development. How can I ref the parent view controller in a sub view controller?
BadmintonCat
  • 9,416
  • 14
  • 78
  • 129
0
votes
1 answer

How to access OSX NSApplication from StoryBoard created default ViewController?

I’ve used Xcode 6.3 to create a very simple Swift Mac application. It is not a document-based app. My app has one NSViewController, and it loads, opens and runs as expected. However, now I need to use the Application menu, and I don’t see the…
Charlweed
  • 1,517
  • 2
  • 14
  • 22
0
votes
1 answer

When is NSViewController fully initialized and safe to reference all subcomponents?

I've read the class reference on NSViewController, but I was still wondering if an instance is fully initialized when it calls viewDidLoad(), or if I should wait for viewWillAppear() or something else. In particular, I'm using Xcode, and I want to…
Charlweed
  • 1,517
  • 2
  • 14
  • 22
0
votes
1 answer

NSViewController not dealloc'd when outlets are bound

I have the following files: Main.storyboard This is the same as the default storyboard created when creating a new project with a few additions: There is a button in the view which is connected to the button outlet of the view controller (instance…
DanielGibbs
  • 9,910
  • 11
  • 76
  • 121
0
votes
1 answer

NSViewController StoryBoard Opening Window Error

I'm working on a program with several view-controllers, all of which I open at various instances as sheets, by controlling dragging from a button on one viewcontroller to another viewcontroller, and by selecting "Sheet". This has always worked,…
GregarityNow
  • 707
  • 1
  • 11
  • 25
0
votes
2 answers

Add new view controller and push on that in cocoa application

I am new to OS X application. In iOS there is methods like : 1. self.window.rootViewController = self.viewController; 2. [self.window addSubview:self.viewController.view]; to add view controller in window or 3. DefaultViewController *objDefault =…
VRAwesome
  • 4,721
  • 5
  • 27
  • 52
0
votes
1 answer

NSView doesn’t catch keyDown events

I need to catch mouseDown and keyDown events in a subclass of NSViewController and as it’s not possible (please, correct me if I’m wrong) I left my GameViewController class blank and put all it’s methods to a new GameView class. In the identity…
new_user
  • 13
  • 3
0
votes
2 answers

Initial ViewController not getting called

I am an iOS developer, trying to learn the differences between iOS and MacOS. I have a very simple OSX app that runs fine on Yosemite but on Mavericks, the -viewDidLoad and other viewController methods are not being called, and I end up with an…
Mel Burr
  • 37
  • 6
0
votes
1 answer

Initwithnibname:bundle: can't load xib with 2 view controllers from a resource bundle

The latter part of the question may not matter; but I am having an issue loading 2 viewcontrollers from a xib that I have put into a resource bundle. These are the steps I've taken: 1)Create a new target, of type bundle. In the copy resource…
A O
  • 5,516
  • 3
  • 33
  • 68
0
votes
1 answer

On button click "unrecognized selector sent to instance"

Cocoa/Objective-C newbie here. I have a MainMenu.xib file which has a NSView. This is what awakeFromNib in AppDelegate.h looks like : - (void)awakeFromNib { NSViewController *x = [[Login alloc] initWithNibName:@"Login" bundle:nil]; NSView *v = [x…
AyushISM
  • 381
  • 7
  • 21
0
votes
1 answer

Could not create swift NSViewController class in xcode 6

While creating a subclass of NSViewController in Xcode 6 GM seed I cant select the language as swift. Screenshot attached.Anyone experienced problem like this? Why this is happening?
Johnykutty
  • 12,091
  • 13
  • 59
  • 100
0
votes
2 answers

Swift NSViewController

I'm new to cococa and swift, and I'm tring to create a custom ViewController. class StatusUpdate : NSViewController { @IBOutlet var StatusView: NSView! @IBOutlet var eventsFoundCell: NSTextFieldCell! @IBAction func update(sender: AnyObject)…
Nicolas Duval
  • 167
  • 1
  • 9
0
votes
0 answers

NSViewController will not appear over SpriteKit SKScene

I've got a SpriteKit game running on the Mac, and I want to bring up a NSViewController over it, so I do this: self = [super initWithNibName:@"Settings-Mac" bundle:nil ]; [gGameViewController.view addSubview:self.view]; According to the debugger,…
BGreenstone
  • 260
  • 1
  • 11