How to add an outlet connection to send a message to a UI object

There are a lot of other questions in the forums like this but they are so old that I thought I should start a new one. I want to add an outlet connection from my file's owner to an NSButton in a .xib. I can't do it.

The NSButton is declared as an IBOutlet NSButton *myButton; in my .m file. In my .xib the button's class is declared as NSButton.

When I control drag from the NSButton in Interface Builder to the File's Owner's New Referencing Outlet well in the pop-up or the File's Owner in Placeholders nothing happens. There are three other IBOutlets that were in my .m file that are connected. Since I upgraded to XCode 13.3 I can't connect the fourth IBOutlet in my .m file to objects in my .xibs.

This has always been easy but now it can't be done in XCode 13.3. I spent a LONG time trying to do this but I can't.

The Help documentation doesn't even begin to resemble what I actually see in XCode at all, starting with: "In Interface Builder, open the assistant editor (choose View > Assistant Editor > Show Assistant Editor)". What? There's no such menu item in the View menu.

Is this a new super horrible bug in XCode? Should I file a bug report? Does anyone else have this problem?

I did a lot more work on this and I found:

In my panel controller I have four IBOutlets declared like this:

@implementation myAlertController { IBOutlet NSPanel *myAlertPanel; IBOutlet NSTextField *errorTypeField; IBOutlet NSTextField *messageField; IBOutlet NSButton *oKButton; }

The File's Owner is correctly set to the panel controller. The problem is that Interface Builder only recognizes some of the IBOutlets. It knows that the NSPanel is an IBOutlet but even though the controller correctly sets the text in the two NSTextFields it shows an error that the File's owner doesn't have these outlets. Finally it doesn't recognize the NSButton. Even though the button sends the correct message to the controller I can't connect the outlet to it because Interface doesn't recognize the fact that it exists. I've tried everything I can think of to fix this like cleaning and rebuilding, removing and reinserting the text fields, etc. but it won't work. The application I'm working on has a lot of similar controllers and they work. It looks to me like this is another huge bug in XCode Interface Builder.

I guess millions of IBOutlets have been created without problem in Xcode with IB. You are really unlucky. Or there is something you do not do correctly. Could you detail very precisely how your proceed, eventually with some screenshots ?

I figured out how to bring up the assistant editor and connect the NSButton to my source code that way. After I drag the button to the File's owner's implementation, XCode asks me to name the NSButton *. I do this. After this I can connect the NSButton * to the action I want - stopModalDialog. BUT the button is not highlighted and even though it's attributes are set to active, etc. it isn't highlighted and it won't respond to the message [theButton highlight: YES];

Also I'm getting all kinds of error messages from Interface builder like "Auto Layout Localization Localization - Views without layout constraints may clip their content or overlap other views." and "Incorrect Intrinsic size - NSTextField's height does not match its intrinsic content size use "Size to Fit Content" to correct" I can add Constraints to this Panel and this will suppress these errors but it will move the UI objects, resize the window or add autoresizing. I don't need any of this and it's a real hassle to deal with it.

I was able to fix most of this by deleting the Constraints, checking "Show Title Bar", "Hide Title Text" and "Transparent Title Bar" in the Panel attributes and re adding constraints. There are still some weird things going on - for example in the Window's attributes in the right pane its type is NSPanel but in the pane on the left, Interface Builder thinks it's an NSWindow. Maybe the file is corrupted. Apple is now almost requiring Constraints and or resizing sub-views. This is a case of severe over-kill. Lots of complexity where is's not generally needed.

How to add an outlet connection to send a message to a UI object
 
 
Q