Is it possible to use an object in a nib as a sort of template for dynamically creating multiple new objects?

StackOverflow https://stackoverflow.com/questions/1515414

  •  19-09-2019
  •  | 
  •  

Question

I would like to design an NSwindow with a WebView in IB for displaying popup links. I need to be able to instantiate any number of these. Is this possible?

Was it helpful?

Solution

Sure. Typically, your window controller would subclass NSWindowController.

MyWindowController* controller = [[MyWindowController alloc] initWithWindowNibName:@"MyWindowView"];

[controller showWindow];

In your nib, set the Owner to MyWindowController, then hook up your outlets as necessary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top