我试图在我的TapDetectingImageView文件中创建一个新方法,但它给我一个警告,即使我在.h文件中声明了该方法,它也无法找到该方法。
当我构建.m文件时,三个特定的警告都指向文件中的@end行,它们说:“类'TapDetectingImageView‘的实现不完整;’-functionA的方法定义:‘找不到’;‘-functionB的方法定义:’找不到‘”。
我遗漏了什么?我不允许在TapDetectingImageView这样的协议文件中这样做吗?
在我的.h文件中是:
@interface TapDetectingImageView : UIImageView <AVAudioPlayerDelegate> {
id <TapDetectingImageViewDelegate> delegate;
}
@property (nonatomic, assign) id <TapDetectingImageViewDelegate> delegate;
-(void) functionA:(NSString*)aVariable;
-(void) functionB:(NSString*)aVariable;
@end在我的.m文件中是:
-(void)functionA:(NSString*)aVariable {
// do stuff in this function with aVariable
}
-(void)functionB:(NSString*)aVariable {
// do stuff in this function with aVariable
}发布于 2010-04-30 08:31:09
我想通了..。我必须在.m文件中将它们声明为私有方法才能工作,然后将它们作为[self methodName:variableIn] ...for调用,如果我在.h文件中声明它们,它们将无法工作。
我在导入文件之后和implementation之前的.m文件中这样声明了它们
@interface TapDetectingImageView()
// Private Methods
-(void)functionA:(NSString *)aVariable;
-(void)functionB:(NSString *)aVariable;
@endhttps://stackoverflow.com/questions/2726586
复制相似问题