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
950 views
in Technique[技术] by (71.8m points)

ios - invalid nib registered for identifier (CELLNAME) - nib must contain exactly one top level object which must be a UITableViewCell instance

Sorry for the long title, but I wanted it to be clearly seen from a google search. Also, this differs from many of the other similar questions on here as its not specifying a 'null' identifier but one that actually exists.

Essentially the problem occurs when your trying to navigate using one of the cells in a table view controller to segue to another view (Whatever that view may be).

Most people would run into this problem after gunning through the apple tutorial on the 'To-Do List' and expecting the cells to operate in the same motion regardless of their purpose. This problem is probably simplistic to most but for a beginner, its quite hard, it took me around 3 hours.

Basically the error is:

invalid nib registered for identifier (prototypeCell) - nib must contain exactly one top level object which must be a UITableViewCell instance

Where 'prototypeCell' would be whatever your cell is called. This is an exception that occurs immediately as the app is launched.

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

I had the same problem as above but I wasn't using storyboards and the problem just appeared out of the blue.

I found that the solution was in the tableview cell file. I had added a uibutton, but it had been added outside the bounds of the cell by mistake. This meant it was almost like an extra view in the uiview.

Once I found it and deleted this extra view the problem disappeared immediately.

If you have having this error, check the uitableviewcell for extra views and objects added by mistake


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

...