Re: Accessing a property of a view via its controller doesn't work

2021-09-04 Thread Keary Suska via Cocoa-dev
Perhaps a more germane question might be, are you sure that the view controller has a relationship with any window? It is not necessary, as I understand, for a view to exist in a window. A view controller can load a view without placing it into a window, and therefore viewWillMoveToWindow: will

Re: Accessing a property of a view via its controller doesn't work

2021-09-04 Thread Greg Weston via Cocoa-dev
> I access the window of a view by two different ways, in the controller and in > the view, resp., and in the controller, I always get a nil pointer. Have you verified that the view you’re accessing in the controller is the same instance as the one that works? ___

Re: Accessing a property of a view via its controller doesn't work

2021-09-04 Thread Ben Kennedy via Cocoa-dev
> On Sep 4, 2021, at 10:27 AM, Gabriel Zachmann via Cocoa-dev > wrote: > > I access the window of a view by two different ways, in the controller and > in the view, resp., and in the controller, I always get a nil pointer. > > In my app, I have a subclass of NSView, MyView, declared like thi

Re: Accessing a property of a view via its controller doesn't work

2021-09-04 Thread Alex Zavatone via Cocoa-dev
I don’t know why this is happening, but I’ll often populate a variable if I know it from another class and can’t find it from another. By that, I mean if you know the window in the class that opens the preferences, get it and set it in the MasterViewController. > On Sep 4, 2021, at 12:26 PM

Accessing a property of a view via its controller doesn't work

2021-09-04 Thread Gabriel Zachmann via Cocoa-dev
I access the window of a view by two different ways, in the controller and in the view, resp., and in the controller, I always get a nil pointer. In my app, I have a subclass of NSView, MyView, declared like this: @interface MyView : NSView { NSWindow * window_; ... } @property (readwr