Can't connect IBOutlet in Interface Builder

前端 未结 19 2043
别跟我提以往
别跟我提以往 2020-12-04 20:02

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

相关标签:
19条回答
  • 2020-12-04 20:21

    Restarting Xcode 5.1 did it for me.

    0 讨论(0)
  • 2020-12-04 20:21

    I'm a total newbie at this, and I had the same problem. I went to try diatrevolo's suggestion, and, in doing so, found out what was causing my problem. I had originally created my ViewController somewhere random in the project hierarchy, and then moved them into the classes folder. This meant that the actual files were not in the classes folder, but the project thought that they were, so IB was looking in the wrong place. I moved the actual files in to the actual classes file with Finder, and then deleted and readded them in the project. Then everything worked!

    0 讨论(0)
  • 2020-12-04 20:22

    File->Read Class Files (select MyClass.h) Did the job for me.

    0 讨论(0)
  • 2020-12-04 20:23

    In Interface Builder File->Read Class Files, and point it to your File's Owner's class. That fixed it for me.

    0 讨论(0)
  • 2020-12-04 20:23

    I had pretty much the same problem as you did. I don't know if you solved your problem yet but mine was that I changed all the classes' names, including the viewcontroller, but the file's owner's name remain unchanged. So, I double clicked File's owner -> click i in the window opened -> change the name in the Class field to the new viewcontroller name. Then it worked. Maybe you want to try it again and see if it works. Good luck.

    0 讨论(0)
  • 2020-12-04 20:30

    So I don't know exactly why it doesn't automatically make the IBOutlet connections, but i found a workaround. I had to manually add the outlets through the Library in Interface Builder for my customer view controller. If anyone finds the fix to make it automatically read from the .h file (like its supposed to), I'd be very appreciative if they posted it.

    thank you

    0 讨论(0)
提交回复
热议问题