在我的plist中,有字符串类型的项目。代码项目的一些值是A00.0,A00.1等。我尝试在TableView中使用CustomCell在CustomCell中显示这些值,标签是codeLabel。代码为codeLabel提供错误,但不为nameLabel提供错误。此课程不是密钥编码密钥UILabel
当我运行代码,它给了我这个消息:
这个类不是键值编码兼容的关键codeLabel。
这里是我的代码:
#import <UIKit/UIKit.h>
@protocol CustomCellDelegate <NSObject>
- (void)updateInfo:(NSIndexPath*)indexPath;
@end
@interface CustomCell : UITableViewCell
@property (nonatomic, retain) IBOutlet UILabel *codeLabel, *nameLabel;
@property (nonatomic, retain) NSIndexPath *indexPath;
@property (nonatomic, assign) id<CustomCellDelegate> delegate;
@end
我试过,但没有奏效:
@interface CustomCell : UITableViewCell{
UILabel *codeLabel,*nameLabel;
}
我该如何解决这个问题codeLabel?谢谢。
您能向我们展示您的自定义单元的Instrument环境的屏幕截图吗? 一件事情可能是:您将文件的所有者类设置为CustomCell,而不是使用您的图形对象Cell ... – Larme
如何加载自定义单元格?您是否在界面构建器中设置了您的自定义类的文件所有者?有时,当您使用该名称创建连接并删除对象,但连接尝试设置对象时,会出现此错误。 – Zen
我无法附加图像。抱歉。我在CustomCell.h中创建了出口(codelabel,namelabel)。在xib视图中,我将它们放在标签对象上。所以你说它给出了问题? –