I have in my AppDelegate a window that I created and then I set the content view to an NSView subclass “CutoutView” when I perform any actions with newContentView such as getting methods from CutoutView they work great.
// Configure contentView in AppDelegate
newContentView = [[CutoutView alloc]initWithFrame:window.frame];
[window setContentView:newContentView];
Now I have another NSView subclass called MoveFilter and I want to be able to call methods from my CutoutView as well. The problem is in order to do that I have to alloc and init the CutoutView method again and when I do the methods can be called but nothing is displayed since CutoutView was already alloc and init before.
// in MoveFilter
cutOutView = [[CutoutView alloc]init];
[cutOutView someMethod];
What do I need to add to MoveFilter or what can I look at to help me be able to call methods where they will display just like newContentView does? Sorry I am new at this, Thanks!
Get the existing
CutoutViewfrom the app delegate:(Assuming that you have a property for this — it looks like you’re putting it into an ivar.)
or from the window:
(Assuming that the
MoveFilterand theCutoutVieware in the same window.)Or, if neither of these assumptions are true, you can combine the two procedures and get the content view of the app delegate’s window. I’ll leave that as an exercise for you.