0

TapDetectingImageViewファイル内に新しいメソッドを作成しようとしていますが、.hファイルで宣言していても、メソッドが見つからないという警告が表示されます。

特定の3つの警告はすべて、ビルド時に.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

}
4

1 に答える 1

0

私はそれを理解しました...それらが機能するためには、.mファイル内でプライベートメソッドとして宣言し、次にそれらを[self methodName:variableIn]...として呼び出す必要がありました...何らかの理由で、.hで宣言した場合は機能しませんファイル。

インポートファイルの直後と前に、.mファイルで次のように宣言しましたimplementation

@interface TapDetectingImageView()
// Private Methods
-(void)functionA:(NSString *)aVariable;
-(void)functionB:(NSString *)aVariable;
@end
于 2010-04-30T00:31:08.750 に答える