0

My app will display a drop down notification when the user needs to be notified about something. The problem I am facing is that if I display a drop down notification, and there is an ad behind it, it intercepts the touch on the notification. I have a boolean currentlyDisplayed which is YES when the notification is still being displayed. If currentlyDisplayed == YES, I want to intercept the touch on the ad and not display it modally. How do I go about doing this? Thanks!

Sincerely, Kamran 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]];
        }];
    }
}
kamran619
  • 531
  • 10
  • 32

1 Answers1

0

Why not opt for a simpler approach and just set your adView.hidden = YES when a notification shows up? Just set hidden back to NO when the notification is about to be dismissed and you should be fine.

RajPara
  • 2,281
  • 1
  • 16
  • 9