1#import "ViewController.h" 2#import <Flutter/Flutter.h> 3#import <FlutterPluginRegistrant/GeneratedPluginRegistrant.h> 4 5@implementation ViewController 6 7- (void)viewDidLoad { 8 [super viewDidLoad]; 9 UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 10 [button addTarget:self 11 action:@selector(handleButtonAction) 12 forControlEvents:UIControlEventTouchUpInside]; 13 [button setTitle:@"Press me" forState:UIControlStateNormal]; 14 [button setBackgroundColor:[UIColor blueColor]]; 15 button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); 16 [self.view addSubview:button]; 17} 18 19- (void)handleButtonAction { 20 FlutterViewController* flutterViewController = [[FlutterViewController alloc] init]; 21 [GeneratedPluginRegistrant registerWithRegistry:flutterViewController]; 22 [self presentViewController:flutterViewController animated:false completion:nil]; 23} 24 25@end 26