Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
596 views
in Technique[技术] by (71.8m points)

ios - Cannot add a PrototypeCell to UITableView inside xib file

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 enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...