Ho esaminato quasi tutte le domande correlate su questo argomento in StackOverflow e ho provato tutte le possibili soluzioni, ma non riesco ancora a capire perché ottengo questo errore:Sottoclasse UITableViewCell personalizzata: questa classe non è un valore chiave conforme alla codifica
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<CustomCell 0x6e627d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key title.'
sto cercando di caricare una cella di vista tabella personalizzata con il nibname: @ "CustomCell". La sua classe è assegnata a "CustomCell" (stesso nome di classe del nome del pennino). Il proprietario del file è anche impostato sulla classe che carica queste celle - "ProductsTableViewControllerWithSearch". Tutti i punti vendita del pennino sono collegati a quelli in CustomCell.m
Ecco il mio codice:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellClassName = @"CustomCell";
static NSString *CellIdentifier = @"Custom Items Cell";
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *topLevelItems = [[UINib nibWithNibName:CellClassName bundle:[NSBundle mainBundle]] instantiateWithOwner:self options:nil];
cell = [topLevelItems objectAtIndex:0];
}
//... more irrelevant code here
}
Qualcuno può aiutarmi per favore. Ci sto lavorando da più di 4 ore. Molte grazie!
PS: sto usando ARC e sto sviluppando per iOS 5.
Ecco la mia CustomCell.h.
#import <UIKit/UIKit.h>
@interface CustomCell : UITableViewCell{
UILabel *textLabel;
UILabel *detailTextLabel;
UIButton *starButton;
}
@property (strong, nonatomic) IBOutlet UILabel *textLabel;
@property (strong, nonatomic) IBOutlet UILabel *detailTextLabel;
@property (strong, nonatomic) IBOutlet UIButton *starButton;
@end
Non c'è nulla nella mia CustomCell.m
cosa è CustomCell una sottoclasse di? – JoePasq
@JoePasq UITableViewCell. – acecapades