Can't connect IBOutlet in Interface Builder

前端 未结 19 2044
别跟我提以往
别跟我提以往 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:32

    XCode -> Product -> Clean

    Worked for me.

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

    I wrote out

    @IBOutlet weak var title: UILabel!
    

    in the UIViewController text file then connected from the file to the label in the storyboard, and it worked!

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

    If you failed to connect your UI controls to code via Right-click (or CTRL) -> dropped down list, there is another way. In interface builder, press & hold CTRL, drug mouse from "File's Owner" in the Main window of Interface Builder to your UI control (label, button, etc). The dpopdown list with all defined by you Outlets will be appered. Just choice needed one!

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

    I had the same problem, and I just tried diatrevolo's suggestion: Click File, then Read Class Files, and point to your File's s Owner class.

    This fixed it for me. I would +1 diatrevolo, but I don't have any reputation yet...

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

    kills me every time, but sometimes if you just close and reopen xcode, things are fixed... Just happened to me with this exact problem...

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

    After I localized some XIB files, the views did not react to any updates made in Interface Builder. Simple solution was to delete the app from the simulator / device. The next Build&Run updated the application correctly.

    This only happened while deploying the app via XCode on the simulator. Seems like XCode is trying to optimize the build and gets confused.

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