Xcode 4:创建一个UIView xib,没有正确连接 [英] Xcode 4: Creating a UIView xib, not properly connecting
问题描述
我正在尝试创建一个包含将嵌入TableViewCell的视图的nib。我已经创建了接口和实现文件, ResultCell.h
和 ResultCell.m
。它们是库存的,开箱即用的,没有代码更改。
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
and ResultCell.m
. They're stock, out-of-the-box, no code changes.
然后我创建一个空的XIB文件,并将UIView拖到它上面。然后我单击File的Owner,并将类型设置为 ResultCell
。我点击了视图,并将其类设置为 ResultCell
。
I then create an empty XIB file, and drag a UIView onto it. Then I click File's Owner, and set the type to ResultCell
. I click the view, and set its class to also be ResultCell
.
以下是我遇到的问题:
- 使用助理编辑器视图(我居住)时,
ResultCell.h
文件。我必须通过单击自动并选择文件来强制加载。 - 当我在视图中放置标签,然后按住Ctrl并单击并拖动到.h以创建插座,我收到以下错误消息:无法插入新的插座连接:无法找到有关名为ResultCell的类的任何信息。
- When using the Assistant Editor view (which I live in), the
ResultCell.h
file doesn't appear when I'm viewing the ResultCell.xib file. I have to force it to load by clicking on Automatic and selecting the file. - When I drop a label in the view, and then Ctrl+Click and drag to the .h to create an outlet, I get this error message: "Could not insert new outlet connection: Could not find any information about the class named ResultCell."
我尝试过创建并重新创建视图,但它不起作用,我开始失去耐心。任何帮助都会非常非常感激!
I've tried creating and re-creating the view, and it's just not working, and I've started to lose my patience. Any help would be very, very appreciated!
推荐答案
我今天刚进入类似状态。这很奇怪:我可以将任何XIB(新的或现有的)附加到项目中任何已存在的ViewController类,但我无法创建新的ViewController并将其正确附加到任何XIB。 助手功能不起作用,IB到头文件连接功能也不起作用。
I got into a similar state just today. It was very odd: I could attach any XIB (new or existing) to any already-existing ViewController class in the project, but I could not create a new ViewController and have it attach properly to any XIB. The "assistant" functionality didn't work, nor did the IB-to-headerfile-connection functionality.
关闭项目并重新打开并没有修复它。 br />
退出XCode并重新启动并没有解决它。
创建一个新项目并测试功能正常,这让我相信某些缓存中有某些东西已经损坏。
Closing the project and re-opening did not fix it.
Quitting XCode and restarting did not fix it.
Creating a new project and testing the functionality worked fine, which led me to believe there was something corrupt in some cache somewhere.
我的解决方案
- 关闭您的项目。
- 转到〜/ Library / Developer / XCode / DerivedData文件夹并删除所有引用您正在处理的项目的子文件夹。
- 打开您的项目在XCode中。现在应该解决这个问题。
顺便说一句,只是运行完全清理似乎并没有解决问题。我不得不废弃派生数据。我确定我因为我正在玩的git游戏而进入这个位置,但我不知道如何离开,因为即使切换回早期的git版本也无济于事。 (这也是一个很大的线索,它是项目本身没有的东西。)
Incidentally, just running a full clean did not seem to clear things up. I had to trash the derived data. I'm certain I got into this position because of git games I was playing, but I had no idea how to get out, because even switching back to earlier git revisions didn't help. (That was a big clue also that it was something untracked by the project itself.)
这篇关于Xcode 4:创建一个UIView xib,没有正确连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!