views:

60

answers:

1

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 <TapDetectingImageViewDelegate> 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

}
A: 

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
iWasRobbed

related questions