开发者

Error message when trying to insert method into touchesBegan

I am trying to create a new method within my TapDetectingImageView file and it's giving me a warning that it cannot find the method even though I have it declared in the .h file.

The specific three warnings all point to the @end line in the .m file when I build it and they say: "Incomplete implementation of class 'TapDetectingImageView' ; 'Method definition for '-functionA:' not found" ; "Method definition for '-functionB:' not found"

What am I missing? Am I not allowed to do this in a protocol file like TapDetectingImageView?

In my .h file is:

@interface TapDetectingImageView : UIImageView <AVAudioPlayerDelegate> {

id <TapDetecti开发者_C百科ngImageViewDelegate> delegate;

}

@property (nonatomic, assign) id <TapDetectingImageViewDelegate> delegate;

-(void) functionA:(NSString*)aVariable;
-(void) functionB:(NSString*)aVariable;

@end

In my .m file is:

-(void)functionA:(NSString*)aVariable {

// do stuff in this function with aVariable

}

-(void)functionB:(NSString*)aVariable {

// do stuff in this function with aVariable

}


I figured it out... I had to declare them as private methods within the .m file in order for them to work and then call them as [self methodName:variableIn] ...for whatever reason they wouldn't work if I declared them in the .h file.

I declared them like this in the .m file right after the import files and before implementation:

@interface TapDetectingImageView()
// Private Methods
-(void)functionA:(NSString *)aVariable;
-(void)functionB:(NSString *)aVariable;
@end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜