无法在xib文件中向UITableView添加PrototypeCell [英] Cannot add a PrototypeCell to UITableView inside xib file

查看:127
本文介绍了无法在xib文件中向UITableView添加PrototypeCell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是IOS的新手。我想在xib文件中创建一个 UITableView 而不是我的 Main.storyboard

但问题是当我将 UITableViewCell 拖入 UITableView 时,它不像 Main.storyboard 。

我的 Main.storyboard 现在有很多屏幕所以加载时速度很慢而且很难找到任何屏幕。因此,我想把 UITableView 放到xib文件中。

I am new in IOS. I want to create a UITableView in a xib file instead of my Main.storyboard.
But the problem is when I drag a UITableViewCell in to UITableView, it does not work like in Main.storyboard.
My Main.storyboard now have many screen so it's very slow when load and also it's hard to find any screen. Therefore, I want to put put UITableView to xib file.

我是否错过了什么或者我做错了什么?

任何帮助将不胜感激

Do I miss something or I make something wrong?
Any help would be appreciated

这是描述图像

Here is the describe image

推荐答案

对不起,原型单元格仅在基于故事板的项目中可用。希望你不会在xib方法上走得太远,可以尝试多个故事板。如果你发现它们有点压倒性,那就没关系;它们会变得更好 - 请注意,您不必为所有视图控制器配备一个故事板。您可以使用代码链接或使用故事板引用链接。

I'm sorry, but prototype cells are available only in storyboard-based projects. Hopefully you won't have gone too far down the xib approach and can try multiple storyboards instead. If you find them a bit overwhelming, it's OK; they get better – note that you don't have to have one storyboard for all your view controllers. You can have several, either linked in code or using storyboard references.

如果您想坚持使用xib,另一种选择是使用 registerNib 代码。因此,您在xib中设计原型单元,然后在代码中注册它们。不太顺利,但它可能适合您的需求。

If you want to stick with xibs, another option is to use registerNib in code. So you design your prototype cells in xibs, then register them in code. Not quite as smooth, but it might suit your needs.

这篇关于无法在xib文件中向UITableView添加PrototypeCell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆