Sorry about the vague question but I don’t know how to make it more specific because I don’t know what is wrong with the code. You guys probably can tell right away what those errors mean.
I’m trying to get overlay image to show up when the app is started and then to make the overlay go away with a tap gesture. I just can’t get this to work. I got the code from a different SO question (link: Create click-through overlay instruction view). Any ideas what I’m missing here? My code shows the error messages that I receive (2 errors, 1 warning).
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 *'
}
You can ether remove the line
or implement the delegate. Add this at the top of AppDelegate.m to get rid of the warning.
And it looks like, that you are missing the
UIImageViewproperty.Go and add the property to the interface extension above. This should look like so: