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
5 answers

NSViewController viewWillAppear cocoa

I want to interchange views in cocoa MAC app development like UINavigationController for push/pop views in cocoa touch. Its a requirement of the app for push and pop views, somehow i could managed to do achieve this, but now i am in middle of…
Sahil Arora
  • 213
  • 3
  • 8
0
votes
1 answer

Working with ViewControllers in Objective-C

This is my AppDelegate.m file: #import "AppDelegate.h" #import "LoginViewController.h" @implementation AppDelegate @synthesize window = _window; @synthesize viewController = _viewController; - (void)applicationDidFinishLaunching:(NSNotification…
Thunder
  • 611
  • 1
  • 8
  • 25
0
votes
1 answer

NSViewController.view (Subviews) setTag

Each time I press a button, mainController is calling [self.view addSubview: createCustomView.view]. Everything works fine here. The problem is that I need to put a tag on each subview I create in order to retrieve them later. I've already tried…
0
votes
3 answers

View Controller Doesn't respond to Action Methods

I have a simple test app (in OSX) that has a view controller with a button in its view. The button's action method is in the view controller's class, and that IBAction is connected in IB (through File's Owner). When the button is clicked, I get an…
rdelmar
  • 103,982
  • 12
  • 207
  • 218
0
votes
1 answer

initWithNibName either called twice or wrong xib loaded

I'm programming a Cocoa application and want the application to work as a kind of Wizard. So in the main window I have a Custom View that interacts with the user and changes from a sign in to a device activation screen as they step through the…
Katie
  • 253
  • 1
  • 3
  • 13
0
votes
2 answers

"Applications are expected to have a root view controller at the end of application launch" error only on device

I know there are other posts with similar questions and I've checked them out but none of them seems to be about my specific issue, so please bear with me. I'm developing an application which is supposed to run on iPad only, so no universal stuff:…
CCSwift
  • 37
  • 5
0
votes
1 answer

Adding Subviews to NSView show up, but can not be removed

In my application window I have two NSViews. On the left the NSView ("Menu") contains a few buttons. When one of the buttons is clicked it should change the contents of the right NSView ("Content"). For each of the views on the right I have a…
Joseph
  • 9,171
  • 8
  • 41
  • 67
-1
votes
1 answer

How do I change viewControllers in swift with Foundation Xcode

I am trying to programmatically switch to another viewController scene when a certain event happens in Xcode for a MacOS app but am having trouble. The second view controller is in the same storyboard as the one I am trying to switch from. I…
Ninten
  • 11
  • 1
-1
votes
2 answers

How to hidden the sub NSView according to the window size in Mac OS?

I am coding an MacOS app with swift. The main layout in the window is like follows: The NSStackView has a sideBar (NSTableView) and a NSView. What I want to achieve is listed here: The width of the sideBar is fixed when changing the window…
david
  • 842
  • 2
  • 8
  • 25
-1
votes
2 answers

What insane Autolayout logic is this?

I create a new view controller. I add a vertical stack to it. Spacing = 0, Alignment = Center X, Fill Equally. I constrain it to the 4 edges of its superview with space = 0.\ I add 3 horizontal stacks inside the main stack. For each of the the…
Duck
  • 34,902
  • 47
  • 248
  • 470
-1
votes
1 answer

Change window root view controller

I am using Xcode 8 on macOS 10.11.6 for a Cocoa Application development. By defaut, the root viewcontroller of the main window in story board is connected to a single NSViewController object, and I can find the segue defined in the IB oabel.…
Yimin Pang
  • 35
  • 3
-1
votes
2 answers

How to attach a custom menu to the main view in a OS X desktop app in Swift

Given the following GitHub project: https://github.com/kellyjanderson/swift-custom-menue How do I link the menu item Custom >> Custom Action, to the function customAction in the ViewController?
Kelly Anderson
  • 462
  • 4
  • 11
-1
votes
3 answers

Passing data between unrelated view controllers

How to pass data between two different (unrelated) view controllers? From my understanding of delegates, a relationship of some sort is required (eg. Prepare for segue, etc). I have a separate view controller that displays search results, and I want…
user3601148
  • 175
  • 1
  • 9
-1
votes
2 answers

How set initial values for stored property with initializers?

This code doesn't work. import Cocoa class ViewController: NSViewController { @IBOutlet weak var textField: NSTextField! var guessScore : Int override func viewDidLoad() { super.viewDidLoad() } override init(){ …
Z.S.
  • 39
  • 1
  • 9
-1
votes
1 answer

Right way of passing data between 2 NSView Controllers in OS X objective c app

To avoid marking this question as duplicate: I have seen this question (Passing Data between View Controllers) but that is for iOS. I have seen many other similar questions, but they all provide answers for IOS. My question is for OS-X app. And yes,…
user2417624
  • 653
  • 10
  • 32
1 2 3
27
28