开发者

applicationWillTerminate normal exit vs ad exit iPhone question

开发者 https://www.devze.com 2022-12-09 06:58 出处:网络
Is it possible to determine when an app is closing whether it is done by normal means (home button) or because an ad was clicked (admob ad for this example)... Admob doesn\'t have anything tha开发者_J

Is it possible to determine when an app is closing whether it is done by normal means (home button) or because an ad was clicked (admob ad for this example)... Admob doesn't have anything tha开发者_JAVA技巧t would help accomplish this goal does it? Any ideas where to start would be greatly appreciated...


If no other/better means are available, put a UIView over the ad area, detect touches on it, make a note then pass that to the next responder (which is the ad's view).

In other words, you need a method you can call to tell you that admob was clicked, and a subclass of UIView, which is positioned right over the admod view, that has the following touchesBegan:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
     // you may want to do some extra work here to detect whether the touch is a 
     // touchUp in the view, vs. a touchUpOutside which is not the same.  It all
     // depends on how admob treats touches.  If it immediately quits your app on
     // touchdown, then you call your method immediately.  If admob waits to see
     // if there is a touchUp in its view, then you need to detect the same and
     // call your method after that.  Play around to see what you need to mimic.

    [self adViewHasBeenTouched];

     // The following is needed to let admob get the touch, after you are done
     // with your method.

     [self.nextResponder touchesBegan:touches withEvent:event];
}
0

精彩评论

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