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
2
votes
2 answers

how can i get window's contentView to "hug" it's subViews

like this question, i have an NSView which is the contentView for an NSWindow and it contains several subviews stacked vertically one above the other. some of them are fixed size and some of them can be expanded or collapsed with a disclosure…
pjv
  • 566
  • 3
  • 16
2
votes
1 answer

Why aren't my NSViews in my NSWindow resizing when the window is resized?

I'm pulling my hair out trying to figure why my views aren't resizing with my NSWindow on drag. Okay, here's my structure: Subclassed NSWindowController's View (Use Auto Layout Checked for window. Auto Resize checked for view. Window's View not…
aroooo
  • 4,726
  • 8
  • 47
  • 81
2
votes
1 answer

Binding an NSViewController's representedObject

Is it possible to bind the representedObject property of a NSViewController to an NSArrayController's selection property (which is a NSManagedObject)? [self.ressourcesViewController bind:@"representedObject" toObject:self.ressourcesController…
bijan
  • 1,675
  • 18
  • 30
1
vote
1 answer

NSMutableArray not being filled before it needs to be loaded

I'm attempting to set up a simple Mac-based 2D tiling engine, using a 2D NSMutableArray for mapping purposes. I am using a subclass of NSViewController with a reference to the map object (which contains said array) and passing drawing requests for…
user1170089
1
vote
1 answer

Cocoa: setters in an NSViewController view

I'm using an NSViewController class with a single view in it to display a progress indicator bar and some text fields. I'm trying to use progressIndicator setMaxValue:and theTextField setStringValue: but neither of these are doing anything. I've…
Elbimio
  • 1,041
  • 2
  • 10
  • 25
1
vote
1 answer

How to bind nib custom view to a NSVIew subclass

I have a simple requirement. On Click of a + button, I am trying to add a custom view to a SplitView. I have created a class MyCustomView which is a subclass of NSView In the applications nib file, I have a custom view which contains the buttons…
1
vote
2 answers

If an NSManagedObject subclassed object is an NSViewController's representedObject is it a fault?

in an NSViewController subclass this BOOL returns "fault is (null)" in the console: Submission *sub = [self representedObject]; BOOL fault = [sub isFault]; NSLog(@"fault is : %@", fault); i do have the sub managedObject's properties, so i know that…
lulu
  • 669
  • 10
  • 26
1
vote
2 answers

How do I show a new/additional NSViewController in swift macOS App with no modal

step1. I new a project in Xcode 13.2.1 with macOS App, swift and storyboard step2. The default NSViewController named InitialViewController. I add a button named open. step3. I add a NSViewController named NewViewController and storyboard ID is…
marky1
  • 21
  • 2
1
vote
2 answers

Split NSTabView across multiple NSViewControllers and XIBs

I'm just getting into desktop Cocoa development (I have experience with iOS development). If this question seems basic, forgive me. That being said, I'm dealing with a large program with lots of calculations and functionality to deal with. There are…
FeifanZ
  • 16,250
  • 7
  • 45
  • 84
1
vote
1 answer

Sharing an object for binding (specifically an NSDocument) between various views / nibs

I'm writing an application for OSX (Lion) using Xcode 4. Hitting a bit of a wall with this one and the internet has thus-far proved not particularly helpful. I have a document defined, as well as the MainMenu.xib and a document window; The document…
Clint
  • 6,133
  • 2
  • 27
  • 48
1
vote
2 answers

viewDidLoad() not called

Either there is something weird in my project (Mojave, XCode10) or I am missing something very basic. This is my whole code: import Foundation import Cocoa class ViewController: NSViewController { public init () { …
MassMover
  • 529
  • 2
  • 17
1
vote
1 answer

Swapping views - NSWindowController and NSViewController(s)

I'm very new in Mac OS programming. At the moment I'm trying to create simple measurement application which will have one window with the toolbar at the top and the appropriate view in the bottom. Clicking button in the toolbar should result in…
1
vote
1 answer

Using toolbar with several NSViewControllers

I've a single window Document-based application that loads several NSViewControllers that serve as the main view. Each view controller is a self-contained class that deals with certain business needs and as such implements all methods necessary to…
ruipacheco
  • 15,025
  • 19
  • 82
  • 138
1
vote
0 answers

objective-c : custom segue transition between 2 viewControllers

I've inherit from NSStoryboardSegue in order to implement a custom transition between 2 VCs. @interface MyReplaceSegue : NSStoryboardSegue @end @implementation MyReplaceSegue -(void)perform { NSViewController *s = self.sourceController; …
Zohar81
  • 4,554
  • 5
  • 29
  • 82
1
vote
1 answer

Is there a way to contain a url within a controller in macOS swift 5

Thanks to this q/a, I've added a URL to an NSTextField. Is it possible to contain the web page in my own view controller?
ICL1901
  • 7,632
  • 14
  • 90
  • 138