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

NSViewController IBOutlet is always nil

I have a Cocoa app that has a main NSWindowController and inside a NSView connected to a NSViewController object like this: CloudCardsViewController is a NSViewController with its Nib and IBOutlet to a NSStackView. When I try to access to the…
mhergon
  • 1,688
  • 1
  • 18
  • 39
2
votes
1 answer

Set position of nspopover

I have a view controller (A), which will show another viewcontroller (B) as a popover. In my VC (A) is an NSButton with this IBAction: self.presentViewController(vcPopover, asPopoverRelativeTo: myButton.bounds, of: myButton, preferredEdge: .maxX,…
Trombone0904
  • 4,132
  • 8
  • 51
  • 104
2
votes
3 answers

add custom view from nib to viewcontroller

I have a viewcontroller with a custom view area on the top, as seen in the below image I want to load a custom xib into this area and I am struggling to do so. I created a ABC.swift file which is a subclass of NSView and a .xib file with the same…
sumesh
  • 2,179
  • 2
  • 21
  • 37
2
votes
1 answer

How to capture escape key in an NSWindow?

I've got a storyboard with an NSWindowController (the storyboard entry point), whose content is an NSViewController. When the user selects a menuitem in my application, I load the storyboard and display it. Now I want the "escape" key to close the…
Tiny Tim
  • 21
  • 2
2
votes
0 answers

NSWindow transition animation for View Controller Segues

I've been trying to figure out how to get a NSWindow to perform a transition animation with Swift 3. I found a few examples in Objective-C, but I haven't been able to tease out the relevant details and translate into the target language / newer SDK…
user479947
2
votes
1 answer

Switching view controller on osx with NSViewController

I have a view with a loading bar on my story board. While my code is operating i want the loading bar to proceed. Once it is finished i want to load another view controller with a button. I tried this by loading a new view Controller but i don't…
Silve2611
  • 2,198
  • 2
  • 34
  • 55
2
votes
1 answer

NSView overlaying NSPageController disappearing on transition

I have an NSPageController containing 8 or so NSViewControllers. I want to have a semi transparent bottom bar when the mouse is inside of the window, and a semi transparent top bar that persists no matter where the mouse is. I add the top bar and…
Jake M.
  • 105
  • 8
2
votes
1 answer

In OS X who owns the model, NSDocument or NSViewController

Working in iOS I've never dealt with OS X and NSDocument based apps. Where should the model reference live, inside the NSDocument or the representedObject in the NSWindow's content NSViewController? Or both?
ahwulf
  • 2,584
  • 15
  • 29
2
votes
2 answers

Force refresh on another ViewController component with swift

I'm trying to pass a trigger between 2 view controller but i can't find something that works ... I have the main controller with a NSTableView, source linked, View Base. main Controller class : class ViewController: NSViewController { I have an…
n savoini
  • 422
  • 1
  • 3
  • 13
2
votes
1 answer

Closing NSViewController which presented as sheet

Let me tell you from the beginning, I have this initial view controller. From which I go to home view controller, by presenting it from the initial view controller, and I perform performClose on initial view controller so that it get's closed. Now I…
user6375148
2
votes
2 answers

Force Aspect Ratio when user Resizing AVPlayerView - Swift OS X Cocoa

I would like to be able to force an AVPlayerView to have a 16:9 aspect ratio, even if the user decides to resize the window. Right now I have it so that my view opens automatically with a 16:9 ratio (800x450) Screenshot: …
user3697446
  • 113
  • 1
  • 9
2
votes
1 answer

Swift: Adding button to bottom bar NSWindow

I created a bottom bar by doing: window.setContentBorderThickness(24.0, forEdge: NSRectEdge.MinY) Is it possible to add a button into the bottom border?
fredsco
  • 313
  • 4
  • 19
2
votes
2 answers

Use NSViewController with Custom View

I have a main .xib view with parts of it being made up of custom views. At the same time I have also created separate .xib subviews (together with their respective .h and .m files). These custom classes were then connected to the custom views in the…
Keith
  • 133
  • 11
2
votes
1 answer

NSViewController -- dismiss with memory cleanup

My environment is Yosemite 10.10.5 with Xcode 7.2 using ARC. In a simple test program, I am attempting various ways to dismiss a NSViewController and all of them are showing problems with memory handling. In my primary view controller, I have the…
Phillip Mills
  • 30,888
  • 4
  • 42
  • 57
2
votes
1 answer

NSSearchField and NSSegmentedControl inside an NSToolbar

The setup: I'm writing an document-based app targeting OS X 10.11 using storyboards. The main window has an NSToolbar with a 3-segment NSSegmentedControl. When the segmented control is clicked, it should toggle the collapsed state of an…
Andrew
  • 7,630
  • 3
  • 42
  • 51