我以前使用下面的代码,并且在iOS12中运行良好:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
let statusBarRect = UIApplication.shared.statusBarFrame
guard let touchPoint = event?.allTouches?.first?.location(in: self.window) else { return }
if statusBarRect.contains(touchPoint) {
NotificationCenter.default.post(statusBarTappedNotification)
}
}
但是它在iOS13中不再起作用。有什么想法吗?
答案 0 :(得分:0)
我已经能够检测到Objective-C类别为UIStatusBarManager
的拍子。我认为这不是快速扩展或其他快速方式的可能性。
@implementation UIStatusBarManager (CAPHandleTapAction)
-(void)handleTapAction:(id)arg1 {
// Your code here
}
@end