在VC中使用未声明的标识符,但在Custom UIImageView中声明了它

rc1铁人

我在使用未声明的标识符时遇到了麻烦。我创建了一个自定义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;
卡尔提卡
@property (nonatomic, strong) NumberPadImageView *imageView;

在viewDidLoad中,

self.imageView = [[NumberPadImageView alloc]init];

通过访问

self.imageView.answerLbl

并将answerLbl声明为属性,

@property (nonatomic, strong) UILabel *answerLbl; 

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在头文件(C)中使用未声明的标识符

在Xcode中使用未声明的标识符

使用未声明的标识符

未声明的标识符使用arrayfire

FBSDKGraphRequest使用未声明的标识符

使用未声明的标识符“ SKSpriteNode”

使用未声明的标识符-Xcode

使用未声明的标识符UIApplicationOpenSettingsURLString

使用未声明的标识符“ UILocalNotification”

使用未声明的标识符“kDefaultNative”

解析中的“使用未声明的标识符'PFUser'”

使用自定义功能在排序列表中使用未声明的标识符

使用未声明的标识符“self”。当我尝试在函数中使用 [self presentViewController] 时

C-在函数中使用未声明的标识符。CS50

在Go程序中使用C代码时的未声明标识符

在Visual Studio中使用C ++类-未声明的标识符错误

在Objective c中使用Swift类。发生未声明的标识符错误

在iOS 8(Xcode 6)中使用未声明的标识符'GL_BGRA_EXT'错误?

如何处理`使用未声明的标识符“ UIDevice”

错误:使用未声明的标识符'groupRectangles'

使用未声明的标识符 __glibcxx_assert

使用简单宏C ++的未声明的标识符错误

Facebook SDK Swift-使用未声明的标识符

使用未声明的标识符DISPATCH_PRIORITY_DEFAULT

使用未声明的标识符“ gl_InstanceID”

错误:使用未声明的标识符“ ctime_s”

错误:使用未声明的标识符“标签”

错误的“使用未声明的标识符'{IDENTIFIER}'”

Xcode 使用未声明的标识符“func”