Reputation: 131
I used the code below before, and it worked perfectly fine in 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)
}
}
But it does not work in iOS13 anymore. Any thoughts?
Upvotes: 0
Views: 1942
Reputation: 53301
I've been able to detect the tap with an Objective-C category of UIStatusBarManager
. I don't think it's possible as a swift extension or other swift way.
@implementation UIStatusBarManager (CAPHandleTapAction)
-(void)handleTapAction:(id)arg1 {
// Your code here
}
@end
Upvotes: 3