在我的appDelegate中,我重写touchesBegan
以检测何时单击状态栏:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; CGPoint location = [[[event allTouches] anyObject] locationInView:kWindow]; CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; if (CGRectContainsPoint(statusBarFrame, location)) { ///do something } }
在iOS 13之前,此功能有效;在iOS 13上则没有。该方法从不执行。我怎样才能解决这个问题?