Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
ViewController.m
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#import "ViewController.h"
6
7@interface ViewController ()
8
9@end
10
11@implementation ViewController
12
13- (void)viewDidLoad {
14 [super viewDidLoad];
15 UIButton* openShare =
16 [UIButton systemButtonWithPrimaryAction:[UIAction actionWithHandler:^(
17 __kindof UIAction* _Nonnull action) {
18 UIActivityViewController* activityVC =
19 [[UIActivityViewController alloc] initWithActivityItems:@[ @"text to share" ]
20 applicationActivities:nil];
21 activityVC.excludedActivityTypes = @[
22 UIActivityTypePrint, UIActivityTypeCopyToPasteboard,
23 UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll
24 ]; // Exclude whichever aren't relevant
25 [self presentViewController:activityVC animated:YES completion:nil];
26 }]];
27 openShare.backgroundColor = [UIColor systemPinkColor];
28 [openShare setTitle:@"Open Share" forState:UIControlStateNormal];
29 [self.view addSubview:openShare];
30 openShare.frame = CGRectMake(0, 0, 200, 200);
31}
32
33@end