2

I have created a custom view that is intended to be loaded in some different windows. ActionWidgets is a subclass of NSViewController, complete with its own xib file and its own widget contents.

In a window where it is used, I have created an object for it with Interface Builder, and I've carefully set its xib file and its connections, to both its NSView widget in that window, and to an ActionWidgets IBOutlet variable in the window's owner class.

But the ActionWidgets widgets don't get loaded into that NSView widget, despite all that I've tried. Its methods awakeFromNib() and viewDidLoad() get called, and nibName has the right nib name, so it ought to work.

What else might I need to do?

lpetrich
  • 31
  • 3
  • Do you add the widget to the view in the window? Post a [mre] please. – Willeke Oct 19 '22 at 06:44
  • I did. What I did is in the Interface Builder part of Xcode, so there is no way to post it here. Should I do what I did for my transliterator and create a GitHub repository for it? – lpetrich Oct 20 '22 at 01:46
  • So you don't add the widget to the view in the window? Maybe this helps: [Nesting Custom Classes/XIB's with Interface Builder](https://stackoverflow.com/questions/1750735/nesting-custom-classes-xibs-with-interface-builder) – Willeke Oct 20 '22 at 08:09
  • I tried it and it worked. My code: `ActionContainer.addSubview(Actions.view) Actions.view.frame = ActionContainer.frame` I had to detach ActionContainer from Actions in Interface Builder for it to work, however. – lpetrich Oct 21 '22 at 07:04

0 Answers0