2013-08-01 45 views
-1

在我的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?謝謝。

xib

+0

您能向我們展示您的自定義單元的Instrument環境的屏幕截圖嗎? 一件事情可能是:您將文件的所有者類設置爲CustomCell,而不是使用您的圖形對象Cell ... – Larme

+0

如何加載自定義單元格?您是否在界面構建器中設置了您的自定義類的文件所有者?有時,當您使用該名稱創建連接並刪除對象,但連接嘗試設置對象時,會出現此錯誤。 – Zen

+0

我無法附加圖像。抱歉。我在CustomCell.h中創建了出口(codelabel,namelabel)。在xib視圖中,我將它們放在標籤對象上。所以你說它給出了問題? –

回答

0

你嘗試在兩個單獨的屬性聲明codeLabel和nameLabel?

如果不這樣做,檢查您的標籤連接,並確保它們沒有連接到不存在的屬性,或存在兩次。

+0

它沒有工作,我檢查了你說的。 –

相關問題