0

当用户需要通知某事时,我的应用程序将显示一个下拉通知。我面临的问题是,如果我显示一个下拉通知,并且它后面有一个广告,它会拦截对通知的触摸。我有一个布尔currentDisplayed,当通知仍在显示时为YES。如果currentDisplayed == YES,我想拦截对广告的触摸而不是模态显示。我该怎么做呢?谢谢!

此致 卡姆兰·皮尔瓦尼

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]];
        }];
    }
}
4

1 回答 1

0

为什么不选择更简单的方法并设置adView.hidden = YES通知出现时间?只需hidden回到NO通知即将被解除的时间,你应该没问题。

于 2013-01-02T17:01:50.443 回答