2

是否可以确定应用程序何时关闭是通过正常方式(主页按钮)还是因为点击了广告(此示例中的 admob 广告)... Admob 没有任何有助于实现此目标的东西它?任何从哪里开始的想法将不胜感激......

4

1 回答 1

2

如果没有其他/更好的方法可用,请将 UIView 放在广告区域上,检测其上的触摸,记下然后将其传递给下一个响应者(即广告的视图)。

换句话说,您需要一个可以调用的方法来告诉您点击了 admob,并且需要一个 UIView 的子类,它位于 admod 视图的正上方,具有以下 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];
}
于 2009-10-22T06:23:48.263 回答