Use FlutterAppDelegate in iOS create template (#7845)

On iOS, generate a FlutterAppDelegate subclass for the application
delegate. This avoids touchesBegan:withEvent boilerplate to handle
status bar taps.
This commit is contained in:
Chris Bracken 2017-02-02 18:03:56 -08:00 committed by GitHub
parent 484067edd7
commit aaff608d05
2 changed files with 2 additions and 16 deletions

View File

@ -1,7 +1,6 @@
#import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@interface AppDelegate : FlutterAppDelegate
@end

View File

@ -1,4 +1,3 @@
#import <Flutter/Flutter.h>
#include "AppDelegate.h"
@implementation AppDelegate
@ -30,16 +29,4 @@
// 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