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