あいまいな質問については申し訳ありませんが、コードの何が問題になっているのかわからないため、具体的にする方法がわかりません。あなたたちはおそらくそれらのエラーが何を意味するのかすぐにわかるでしょう。
アプリの起動時にオーバーレイ画像を表示してから、タップジェスチャでオーバーレイを表示しようとしています。私はこれを機能させることができません。別のSO質問からコードを取得しました(リンク:クリックスルーオーバーレイ命令ビューの作成)。私がここで見逃しているアイデアはありますか?私のコードは私が受け取るエラーメッセージを示しています(2つのエラー、1つの警告)。
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIImageView *overlay = [[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"overlayImg.png"]];
[self.window addSubview:overlay];
UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
recognizer.delegate = self; //WARNING: Assigning to 'id<UIGestureRecognizerDelegate>'from incompatible type 'AppDelegate *const__strong'
[overlay addGestureRecognizer:recognizer];
overlay.userInteractionEnabled = YES;
self.overlay = overlay; //ERROR: Property 'overlay' not found on object of type 'AppDelegate *'
// Override point for customization after application launch.
return YES;
}
- (void) handleTap:(UITapGestureRecognizer *)recognizer
{
[self.overlay removeFromSuperView]; //ERROR: Property 'overlay' not found on object of type 'AppDelegate *'
}