I have recently started to build a very basic To-Do List in Xcode 5 as my first project. Having practically finished the UI design and build I am now stuck on the implementation of data into my TableView. I have added a list of 13 items in my list and given the first in the list the 'ListPrototypeCell' identifier and all of my code seems correct. My project has 3 identical issues:
Unsupported Configuration; Prototype cells must have reuse identifiers
I have played around with identifiers on every item, although I have been told I don't need to use an identifier on every item, and I still get these errors.
I am willing to send my project onto anyone that thinks they may be able to help me resolve the issues, to the trained eye it is probably a very basic mistake I have made.
I appreciate any help!
Try this Check your storyboard and confirm there is a reuse identifier for your prototypeCell,
And use the same identifier in your
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"sameReuseIdentifier"];
Go into your storyboard, go to the view controller, go to the table view, go to the tableviewcell, go to the identity inspector, and enter something into the field that says "Reuse Identifier"
You use the reuse identifier for initializing cells based off of the style they are in the table view like this:
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"reuseIdentifier"];
The reason you're getting that error is because some of your prototype cells do not have a reuse identifier on them.
If you don't understand how/when to use prototypes and reuse-id's. You should read: Table View Programming Guide for iOS
reuseidentifier is an id from which you can get cell from it. if you set reuse id "cell" you can access this cell in cellForRowAtIndexPath method
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
}
which means that get cell from stroyboard with reuseid "cell". in your case you have to write above two line as follows
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:nil];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
}
this line shows that every time new cell will be alloc and initialized and it does not use prototype cell.
so prototype cell from storyboard is never used. if you want i can give you demo to mention how it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With