Xcode 4: Creating a UIView xib, not properly connecting

前端 未结 30 3481
时光说笑
时光说笑 2020-12-02 16:29

I\'m trying to create a nib that contains a view that will be embedded in a TableViewCell. I\'ve created the interface and implementation files, ResultCell.h an

30条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 17:00

    This problem seems to be an Xcode bug which creeps up mostly when you replace a file with a new file of the same name. Xcode seems to keep a reference of the older file of the same name.

    Anyhow, the way to fix this seems to be:

    1. Clean the project
    2. Click (Your Project) in Project Navigator view. Go to Compile Sources under Build Phases of the target for which you are building. Remove and add back the .m file which is giving you trouble.
    3. Alternatively, in the File Inspector (Utilities view) of the NIB file, under Target Membership, uncheck and check back the target name.
    4. Restart Xcode for good measure.
    5. Of course, deleting and adding back the .m file alone should fix it too.

    (Steps 1 and 2 alone fixed it for me.)

提交回复
热议问题