mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add touchesBegan handler to iOS AppDelegate template (#7822)
By default, pass status bar taps to the root view controller in generated Flutter apps. Developers should customise as necesary if they later create one or more alternate FlutterViewControllers that they'd like to forward these to.
This commit is contained in:
parent
d2a1e125e9
commit
2bbc028313
@ -30,4 +30,16 @@
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
[super touchesBegan:touches withEvent:event];
|
||||
|
||||
// Support scroll to top on status bar tap. By default, pass status bar taps
|
||||
// to the application's root view controller for handling in Flutter.
|
||||
UIViewController *viewController =
|
||||
[UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
if ([viewController isKindOfClass:[FlutterViewController class]]) {
|
||||
[(FlutterViewController*)viewController handleStatusBarTouches:event];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user