Can't connect IBOutlet in Interface Builder
Solution 1
I did a combination of the things in this thread and I finally had success.
In Interface builder (not xcode)
- File->Reload All Class Files
- File->Read Class Files (select MyClass.h)
- Reconnect File's Owner by
a. Setting the Class to "MyClass"
b. Reconnecting the View to the File's Owner's View
Everything is back to normal now. Weird.
Hope this helps more than it confuses ;-)
Solution 2
Had the same problem.
Fixed it by double checking my File's Owner "Class" attribute on the Identity inspector.
Solution 3
In Interface Builder File->Read Class Files, and point it to your File's Owner's class. That fixed it for me.
Solution 4
Did you make sure you are defining your outlets in your .h file as the appropriate type? If you are trying to connect a text field in IB, then your .h file should look something like...
IBOutlet UITextField *MyTextField;
Make sure the type is UITextField (or UITextView, etc). If you type them as NSString or anything the is not appropriate, then you can't connect them in Interface Builder....
Solution 5
Are you sure the File's Owner is correctly set to your custom UIViewController and that you've saved your .h
file after having added the IBOutlet
keyword to the instance variable and property?
haider
Updated on August 01, 2022Comments
-
haider almost 2 years
I'm having a weird experience. I create any type of iPhone application, add a UIViewController with Xib file. I can edit the xib file with controls and see them rendered if I run. Now i'm trying to add a few IBOutlets to the controller, so I add them to the .h file, synthesize on the .m file. Then i head over to Interface Builder to connect the outlets. I drag the UILabel to the UIView, and then i try to connect the File Owner (which my custom UIViewController), but all that i can select when i try to connect to the UILabel is "view", which is obviosly wrong. So I'm not able to connect IBOutlets to their controls in Interface Builder.
Any ideas?