-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPreviewViewController.m
More file actions
58 lines (46 loc) · 2.51 KB
/
PreviewViewController.m
File metadata and controls
58 lines (46 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// PreviewViewController.m
// 3DTouchExample
//
// Created by Shell.Chu on 2015/11/20.
// Copyright © 2015年 Shell. All rights reserved.
//
#import "PreviewViewController.h"
@interface PreviewViewController ()
@end
@implementation PreviewViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//action sheet
- (NSArray<id<UIPreviewActionItem>> *)previewActionItems
{
UIPreviewAction *action1 = [UIPreviewAction actionWithTitle:@"Action 1"
style:UIPreviewActionStyleDefault
handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
NSLog(@"Action 1 selected");
}];
UIPreviewAction *action2 = [UIPreviewAction actionWithTitle:@"Action 2"
style:UIPreviewActionStyleDestructive
handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
NSLog(@"Action 2 selected");
}];
UIPreviewAction *action3 = [UIPreviewAction actionWithTitle:@"Action 3"
style:UIPreviewActionStyleSelected
handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
NSLog(@"Action 3 selected");
}];
NSArray* actions =@[action1,action2,action3];
UIPreviewActionGroup *group1 = [UIPreviewActionGroup actionGroupWithTitle:@"Group 1"
style:UIPreviewActionStyleDefault actions:actions];
UIPreviewActionGroup *group2 = [UIPreviewActionGroup actionGroupWithTitle:@"Group 2"
style:UIPreviewActionStyleDefault actions:actions];
NSArray *returnArray = @[action1,group1,group2];
return returnArray;
}
@end