nsviewcontroller

Cocoa application architecture on Mac OS X

I'm getting back in to Cocoa development on the Mac after a long stint doing iPhone work. My previous experience with Cocoa on the Mac has just been dinky little tools. I'm looking to build something serious. Looking at a modern Cocoa application like iPhoto (or Mail or Things or....) many apps use the Single-Window, Source-List based a...

Menu Items, Responder Chains, and NSViewController, Oh My!

I must be missing something simple, but I can't see it. First, the setup: DATreeView, a subclass of NSView DATreeViewController, a subclass of NSViewController MainMenu.xib has an instance of DATreeViewController, which is configured to load a view from DATreeView.xib MainMenu.xib also has an instance of DendreaAppDelegate, which has ...

What would you do instead of using NSViewController to be compatible with 10.4?

All I need to do is load and swap some nibs in a NSView of a window. I know how to do it with NSViewController and have it working perfectly with 10.5-10.6, but I don't know what to do for 10.4. Tutorial links very welcome, I have trouble finding legacy stuff. (Yes, I really do need to support 10.4.) ...

NSViewController and multiple subviews from a Nib

I'm having a difficult time wrapping my head around loading views with Interface Builder and NSViewController. My goal is to have a view which meets the following description: Top bar at the top (like a toolbar but not exactly) which spans the entire width of the view, and a second "content view" below. This composite view is owned by m...

After loading nib with NSViewController... how do I access the NSButton in the nib?

I've subclassed NSViewController with IBOutlets hooked into an NSButton in a secondary nib. I can instantiate the NSViewController and apply the view in an NSMenu -- it works great -- but how do I access the button to change its title? Since the NSViewController has IBOutlets, I assumed I'd do this through the controller. //this part ...

NSView inside self window

I have basic *.xib file, which have NSView. How can I use another nib files for this Custom View? What is NSViewController and how should I use it? ...

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? ...

Why "add subview" not work?

Hello, I try add subview but not work. My code is: HomeViewController* homeViewController = [[HomeViewController alloc] initWithNibName:@"HomeView" bundle:nil]; NSViewController *viewController = homeViewController; [mainView addSubview: [viewController view]]; NSLog(@"%@",[viewController view]); NSLog(@"%@",[[viewController view]superv...

Binding selection across multiple view controllers in a single window interface

I am having an issue wrapping my head around how to hook up a few NSArrayControllers across two view controllers. I want to sync the selection in the source list table view to update the values in the second detail view controller. I'm using the Cocoa Dev Central Build A Core Data Tutorial as the starting point, but have broke down ...

How to display a subview loaded from a separate NIB file

I'm developing a Cocoa desktop application that uses a source list in the style of iTunes: different elements in the source list cause the main content area to display different views. The content area is entirely filled with a (vertical) NSSplitView; on the left is an NSOutlineView source list. When the user selects an item on the left...

Is it possible to get an NSView to pass rightMouseDown: to the next responder without subclassing?

I have a view which contains a few subviews: mainView subViewA subViewB SubViewC mainView is an NSView constructed from a nib and is controlled with an NSViewController subclass. The subviews are standard views such as NSTextField and NSImageView and are configured to be non-editable. I want mainView to receive rightMouseD...

Add NSView from different nib

How can I add a subview when the new view is in a different xib file? The class for the different nib is an NSViewController and I'm using self = [super initWithNibName:@"NewView" bundle:nil]; to load the nib Can I just do something like: NewView *nv = [NewView new]; [oldView removeFromSuperView]; [mv addSubview:[nv theView]]; or do...

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. ...

How do I switch out Views in a Cocoa application?

So I'm beginning to learn how to use Cocoa. I think I've pretty much got it but I'm hung up on creating and switching views. I'm rewriting a game I made a little bit ago for practice. All I want is one window (preferably not resizable) and I want to be able to switch out views for different screens in the game. First, I have the main me...

How to have a NSViewController who's view's content depends on the way it's initialized?

This is actually a two part question, hope my explanation is clear: I have an NSViewController which can be configured to show a different custom view on part of its view. For example, its view can show either CustomViewA or a CustomViewB. I was able to make this work by creating an NSViewController for each of the custom views and ini...

Resizing Nested NSViews

In order to categorize a wide variety of unique views, I have an elaborate setup: main categories are selected via a toolbar, and then specific panes are selected in a category's NSScrollView. This looks like: window -> NSViewController controlling five views -> sub-NSViewController for each view controlling X views -> each view contains...

QuickLook consumer as a delegate from an NSViewController

I am having some problems implementing QuickLook functionality from a table in an NSView. The limited documentation on QuickLook really doesn't help at all. After reading through the Apple Docs (which are geared heavily towards custom generators and plugins), I ended up looking at the QuickLookDownloader sample code. This code is based ...

Loading NSView from NIB won't work.

I have this code to load an NSView from a NIB and add it to another NSView: // INIT - (void)awakeFromNib { // Load nib DNListViewController *listViewController = [[DNListViewController alloc] initWithNibName:@"ListView" bundle:nil]; // Add view to window [listViewController.view setFrame:detailView.frame]; [detailView addSubv...

NSView high-level overview?

I am trying to create a custom view and load it into a window. In the end, I know there will be a few steps to follow, reflecting the key relationships that I am missing. I am hoping someone can explain, in a series of steps, how one creates a view object, view controller, associated .xib, and then loads it into a window (after clearin...

Help with "Cannot perform operation without a managed object context"

I have an NSViewController with its own nib that requires access to the managedObjectContext to display objects in a tableview. This is how I have the managed object context set up in my view controller: @interface { ... NSManagedObjectContext* managedObjectContext; ... } @property (nonatomic, retain) NSManagedObjectContext...