2013-01-02 88 views
0

当用户需要收到某些通知时,我的应用会显示一个下拉通知。我面临的问题是,如果我显示一个下拉通知,并且后面有一个广告,它会拦截通知。当通知仍在显示时,我有一个boolean currentlyDisplayed,它是YES。如果目前显示== YES,我想拦截广告的触摸并不以模态方式显示。我如何去做这件事?谢谢!iOS上的拦截广告(Adwhirl)

真诚, 卡姆兰Pirwani

Notification code 

+(void)onTap:(UITapGestureRecognizer *)tapGestureRecognizer { 
    CGPoint point = [tapGestureRecognizer locationInView:tapGestureRecognizer.view]; 

    BOOL dismissTapped = [notificationView.closeNotification.layer.presentationLayer hitTest:point] != nil; 
    BOOL labelTapped = [notificationView.layer.presentationLayer hitTest:point] != nil; 
    if (dismissTapped) { 
     [UIView animateWithDuration:1.0f delay:0.0f options:UIViewAnimationOptionBeginFromCurrentState animations:^{ 
      notificationView.alpha = 0.0f; 
      //notificationView.frame = CGRectMake(currentFrame.origin.x, -currentFrame.size.height, currentFrame.size.width, currentFrame.size.height); 
     }completion:nil]; 
    }else if(labelTapped) { 
     [UIView animateWithDuration:0.7f animations:^{ 
      notificationView.alpha = 0.0f; 
     }completion:^(BOOL finished){ 
      [tapGestureRecognizer.view removeGestureRecognizer:tapGestureRecognizer]; 
      [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"announcementTapped" object:nil]]; 
     }]; 
    } 
} 

回答

0

为什么不选择一个更简单的方法,只是设置你的adView.hidden = YES时通知显示出来?当通知即将被解雇时,只需将hidden设置回NO,您应该没问题。