我知道这个错误的意思,但我真的很挣扎,我需要别人的帮助:
2010-09-21 15:03:11.562 Stocks[5605:207] *** Terminating app due to uncaught
exception 'NSUnknownKeyException', reason: '[<NSObject 0x499fb20>
setValue:forUndefinedKey:]: this class is not key value coding-compliant
for the key actionText.'
Run Code Online (Sandbox Code Playgroud)
这里有我的代码:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface AlertCell : UITableViewCell {
IBOutlet UILabel *actionText;
}
@property (retain, nonatomic) UILabel *actionText;
@end
Run Code Online (Sandbox Code Playgroud)
和
@implementation AlertCell
@synthesize actionText;
- (void)dealloc {
[actionText release];
[super dealloc];
}
@end
Run Code Online (Sandbox Code Playgroud)
问题发生在那里:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
AlertCell *cell =
(AlertCell …Run Code Online (Sandbox Code Playgroud) 首先,这次讨论没有解决我的问题.
自定义UITableViewCell子类:此类不是符合编码规范的键值
建立:
我有一个Person对象数组MainViewController.要显示在一个对象UITableView中AllContactsViewController.
问题:
使用默认值时,所有工作都按预期工作UITableViewCell.当我使用我的自定义时,TableCell我得到一个错误,指出该类不符合键值编码.
我连接我的任何三个之后会出现此错误outlets在IB我的TableCell班.
注意:
TableCell有三个属性:a name&emaillabel + imageView.
希望你能帮忙.
TableCell.h
#import <UIKit/UIKit.h>
@interface TableCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *emailLabel;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end
Run Code Online (Sandbox Code Playgroud)
TableCell.m
#import "TableCell.h"
@implementation TableCell
@synthesize nameLabel, imageView, emailLabel;
Run Code Online (Sandbox Code Playgroud)
AllContactsViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString …Run Code Online (Sandbox Code Playgroud)