【发布时间】:2019-08-02 10:03:36
【问题描述】:
在我的 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 上,它没有。该方法永远不会执行。我该如何解决这个问题?
【问题讨论】:
-
您可以从这篇文章中获得帮助 - medium.com/@hacknicity/…
-
或者您可以按照此处的答案解决此问题 - stackoverflow.com/questions/3753097/…
-
@dfwang 你有同样的解决方案吗?
-
有人解决了吗??
标签: objective-c ios13