我在使用未声明的标识符时遇到问题。我创建了一个自定义 UIImageView 并在其中声明了一个 @property UILabel 'answeLbl'。我已将自定义 UIImageView.h 文件导入到我的 ViewController.h 文件中,但每当我尝试使用“answerLbl”时,都会出现错误“使用未声明的标识符”。我该如何解决这个问题,我需要在我的 ViewController 中使用这个“answerLbl”?
这是 ViewController.h
#import <UIKit/UIKit.h>
#import "NumberPadImageView.h"
@interface ViewController : UIViewController {
NumberPadImageView *numberKeyboard;
}
然后这里是自定义的 uiiimageview => NumberPadImageView.h
#import <UIKit/UIKit.h>
@interface NumberPadImageView : UIImageView {
UILabel *answerLbl;
UIButton *oneBtn;
UIButton *twoBtn;
UIButton *threeBtn;
UIButton *fourBtn;
UIButton *fiveBtn;
UIButton *sixBtn;
UIButton *sevenBtn;
UIButton *eightBtn;
UIButton *nineBtn;
UIButton *zeroBtn;
UIButton *backBtn;
UIButton *periodBtn;
UIButton *clearAnswerFieldBtn;
}
@property (nonatomic, strong) IBOutlet UILabel *answerLbl;
-(IBAction)buttonPressed:(UIButton *)sender;
-(IBAction)backspace:(id)sender;
-(IBAction)clearAnswerLbl:(id)sender;